Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Same productid but different option, so add don't update

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-10-2005, 03:12 PM
 
Gibberish Gibberish is offline
 

Senior Member
  
Join Date: Sep 2003
Posts: 182
 

Default Same productid but different option, so add don't update

Can anyone tell me the location of the code that updates the quantity of an item in the cart if the productid's are the same?

I will explain what I am trying to do just to clarify...

I have items where it is the exact same productid but you pick from a company, and date drop down before you add to cart. If you add the item once it works great.

Now once you have the item in your cart and you go back to choose the same item but change the company and/or date and add that to the cart it updates the quantity of the previously added item. I know this is because in the cart.php or func.php it is seeing if the newly added productid is the same as the productid in the cart. If it is it updated the amount of the product in the cart.

What I want to do is add more to the if statement that updates the quantity. I have checked all over but cannot find the code that updates the cart amount if both productid's are the same.

I removed this line from the func.php (line 2175)
Code:
if ($current_area == "C" and !empty($cart) and !empty($cart["products"])) { foreach($cart["products"] as $cart_item) { if ($cart_item["productid"] == $id) { $in_cart += $cart_item["amount"]; } } }

I also removed this from the cart.php (line 227)
Code:
$product_distribution = func_query_first_cell("SELECT distribution FROM $sql_tbl[products] WHERE productid='$productid'"); if (!empty($cart) and @$cart["products"] and $added_product["product_type"]!="C") { foreach ($cart["products"] as $k=>$v) { if (($v["productid"] == $productid) && (!$found) && ($v["options"] == $product_options) && empty($v["hidden"])) { if ((float)$v["free_price"] != $price) continue; $found = true; if (($cart["products"][$k]["amount"] >= 1) && !empty($product_distribution)) { $cart["products"][$k]["amount"] = 1; $amount = 0; } $cart["products"][$k]["amount"] += $amount; } } }

But it still just updates the product already in the cart if the added productid is the same.
__________________
Gibberish
[Unix] X-Cart 4.0.12
Reply With Quote
  #2  
Old 07-12-2005, 03:23 PM
 
Gibberish Gibberish is offline
 

Senior Member
  
Join Date: Sep 2003
Posts: 182
 

Default

Still unable to find this code.

Can anyone tell me the location of the code that updates the quantity of an item in the cart if the newly added productid is the same as the product int he cart?
__________________
Gibberish
[Unix] X-Cart 4.0.12
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:15 PM.

   

 
X-Cart forums © 2001-2020