Adding a second item to cart removes the first

lwdigitaldesign

06 Apr, 2012 12:43 PM via web

I've used Jigshop for a photographer's website. If there is an item in the cart and a second product is added, the first item gets removed. Anyone have any ideas? The client is going absolutely mental over this.

  1. 2 Posted by chriscct7 on 06 Apr, 2012 12:47 PM

    chriscct7's Avatar

    URL please?

    -Chris

  2. 3 Posted by lwdigitaldesign on 06 Apr, 2012 12:48 PM

  3. 4 Posted by lwdigitaldesign on 06 Apr, 2012 12:50 PM

    Sorry forgot to paste in the two test products:

    http://tommyclancyphotography.ie/index.php/shop/b0002-aerial-view-b...

    http://tommyclancyphotography.ie/index.php/shop/d0003-liberty-hall-...

  4. 5 Posted by chriscct7 on 06 Apr, 2012 04:18 PM

    chriscct7's Avatar

    Hi,
    I tried it, and it works for me in Chrome.

    Chris

  5. 6 Posted by vanbo on 07 Apr, 2012 10:48 AM

    Hi lwdigitaldesign,

    This seems to appear because when the cart is created it is ordered as an array of 0,1,2 ..., but when an item is removed it does not reorder itself (exp: remove item 1 the cart is left with 0,2). I would say this is a Jigoshop bug.

    If you want a workaround until its fixed you can reorder the cart items in the get_cart_from_session function. Like this (I tried it and it works, but you should test it for yourself too)

           $order_key = 0; 
            foreach ($cart as $key => $values) :
                if ($values['data']->exists() && $values['quantity'] > 0) :
                    self::$cart_contents[$order_key] = array(
                        'product_id'    => $values['product_id'],
                        'variation_id'  => $values['variation_id'],
                        'variation'     => $values['variation'],
                        'quantity'      => $values['quantity'],
                        'data'          => $values['data']
                    );
                    $order_key++;
    

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

What is fifteen divided by three?

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.