Page 1 of 1

Stop shopping basket saving products when logging out

Posted: Tue Jan 25, 2011 10:42 pm
by DaveBunny
Hi,

How can I ensure that when a user logs out all of the products in the shopping basket are removed. So that next time when a user logs in they are met with an empty shopping basket.

I'm using version 1.4.9.1.

Many Thanks

Dave

Re: Stop shopping basket saving products when logging out

Posted: Tue Jan 25, 2011 11:29 pm
by JAY6390
Hi Dave

Open
/system/library/customer.php

Find and remove this code

Code: Select all

            if (($customer_query->row['cart']) && (is_string($customer_query->row['cart']))) {
                $cart = unserialize($customer_query->row['cart']);
                
                foreach ($cart as $key => $value) {
                    if (!array_key_exists($key, $this->session->data['cart'])) {
                        $this->session->data['cart'][$key] = $value;
                    } else {
                        $this->session->data['cart'][$key] += $value;
                    }
                }            
            } 

That will stop the cart loading any products previously saved

Re: Stop shopping basket saving products when logging out

Posted: Wed Jan 26, 2011 1:20 am
by DaveBunny
Excellent. Worked a treat!

Many Thanks

Dave

Re: Stop shopping basket saving products when logging out

Posted: Wed Jan 26, 2011 1:29 am
by Qphoria
Or you can make it optional for the customer:
http://forum.opencart.com/viewtopic.php ... 447#p81447

Re: Stop shopping basket saving products when logging out

Posted: Wed Jan 26, 2011 1:59 am
by JAY6390
*cough* need to add it to VQMods ;)