mark2 Posted May 5, 2010 Share Posted May 5, 2010 Hi,If a user:logs in, adds some items to their shopping cart, logs out. Then as a guest adds items to a shopping cart, then logs in.The first shopping cart is lost. I wanted the two carts to be combined. It seems this can be done in the authentication.php file: if (Configuration::get('PS_CART_FOLLOWING')){ if (empty($cookie->id_cart) OR Cart::getNbProducts($cookie->id_cart) == 0) { $cookie->id_cart = intval(Cart::lastNoneOrderedCart(intval($customer->id))); } else { // Combine orders $lastCartID = Cart::lastNoneOrderedCart(intval($customer->id)); if (Cart::getNbProducts($cookie->id_cart) > 0 && $lastCartID) { $last_cart = new Cart($lastCartID); if (!Validate::isLoadedObject($last_cart)) { $products = $cart->getProducts(); foreach ($products as $p) { $last_cart->updateQty($p['cart_quantity'], $p['id_product']); } $last_cart->update(); $cart->delete(); $cart = $last_cart; $cookie->id_cart = $cart->id; } } } } This might be of use to someone. Or you might see a problem with this, in which case your comments would be of use to me.Regards, Mark Link to comment Share on other sites More sharing options...
mark2 Posted January 14, 2011 Author Share Posted January 14, 2011 Hi, the code did not work for customized products but seemed OK otherwise. I'm using 1.2.5 so the code may not work on any other version. I hacked something together to deal with customized products you can PM me about that. Link to comment Share on other sites More sharing options...
aMazy Posted August 22, 2016 Share Posted August 22, 2016 Have anyone tried so solve this in PS 1.6.1.6? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now