Crinsane / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
3.67k stars 1.73k forks source link

cart update not working on different routes. #132

Closed banerjeeaditya closed 8 years ago

banerjeeaditya commented 8 years ago

Hi I am facing a weird problem in which I update the cart in one route but it doesnt reflect the updates in the cart on the other route.

for example I have a route name cart/revalidate and have a method name getIndex in which I am updating the cart. The code is -:

foreach($saleprice as $key => $value){ $row = Cart::instance($cookie)->get($key); $row->options['sale_price'] = $value; $row->options['store_id'] = $storeId; $row->price = $value; $x = Cart::instance($cookie)->update($key, $row->toArray()); }

now when I output the $row in this I could see that the cart has been update but I have another route named cart/view

just print_r the cart instance and I see that the cart has not update

    $cartData = Cart::instance($cookie)->content();
    echo "<pre>";
    print_r($cartData);
    die;

Please assist. Thank You

Crinsane commented 8 years ago

I need more code to debug this. But watch out with die or dd(), because they will destroy the Laravel session (which the cart uses)