Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    database error shopping cart duplicate product ids

    Hi

    When adding a product that is already in the cart, how does zencart know when to create a new item in the cart or just increase the quantity?

    For example I have an apple in the cart already then I want another apple but I want a green one (different attribute) instead?

    So when adding the new apple to the cart instead of increasing the quantity of the first apple to 2, it creates a new cart item so i have 1 green apple and the original apple, so now I have 2 cart items?

    Hope that makes sense the reason I ask is because I'm building a custom cart and whenver I use the function

    $_SESSION['cart']->actionAddProduct

    and add 2 products with the same product_id but different attributes it just creates 1 and increases the quantity.

    Thanks heaps!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: shopping cart duplicate product ids

    Have a look at /includes/classes/shopping_cart.php and about line 110-140 and this might also be replicated later in the file as to how the attributes are queried
    Zen-Venom Get Bitten

  3. #3
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: shopping cart duplicate product ids

    Is this function flawed?

    function zen_get_uprid($prid, $params)

    Say I am selling a T-Shirt and letting the buyer choose the words to be printed on it, they want 2 of the same product but different attributes (or Options as Zen calls them I think)

    because this function generates the same cart key for both T-Shirts it means that it only has the 1 product in the cart with a quanity of 2 but actually it should be 2 products in the cart as they have different attribute values?

    It appears zen_get_uprid is ignoring the values, I did a little test

    $params = array('23'=>array('75'=>''),'txt_22'=>'my t-shirt text','20'=>'74');
    echo zen_get_uprid(180,$params);

    echo "\n\n";

    $params = array('23'=>array('75'=>''),'txt_22'=>'some other text','20'=>'70');
    echo zen_get_uprid(180,$params);

    The result:

    180:ba0769eede0e6eb1ec3d3efa59b30a24

    180:ba0769eede0e6eb1ec3d3efa59b30a24


    Exactly the same keys, but you can see the attribute values are different, shouldn't this function be generating the key from the values too or am I missing something?

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: shopping cart duplicate product ids

    You can't with default code, order 2 of the same items with different lists of attributes in one order
    Zen-Venom Get Bitten

  5. #5
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: shopping cart duplicate product ids

    it's not a different list of attributes, it's the values that are different

    So you are saying that you could not have T-shirt product where you let the user enter in text to be printed on it? and have it be 2 different items in the cart?

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: shopping cart duplicate product ids

    Set this up and try it...

    You can have t-shirt - small - fred - one order/add to cart
    then t-shirt - small - jane - a seperate order/add to cart

    Then one checkout
    Zen-Venom Get Bitten

 

 

Similar Threads

  1. Replies: 3
    Last Post: 27 Apr 2015, 03:47 AM
  2. Reset prod IDs and Categories IDs
    By savchenko01 in forum General Questions
    Replies: 2
    Last Post: 31 Jan 2011, 05:21 PM
  3. Duplicate customer IDs in zen_address_book table
    By dcdiaz in forum Managing Customers and Orders
    Replies: 6
    Last Post: 24 Apr 2010, 05:59 PM
  4. Can't Zen Cart handle +50 product Ids in the shopping cart ?
    By sergiogold in forum General Questions
    Replies: 2
    Last Post: 6 Sep 2007, 06:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg