From dce6247c0c14ca7373bd1de6f601a09ebbbb6c32 Mon Sep 17 00:00:00 2001 From: Gregory Roussac Date: Mon, 28 Jan 2013 18:29:35 +0100 Subject: [PATCH] [-] FO : Fix #PSCFV-6356 recall adresses in cart after login --- controllers/front/AuthController.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 785529f56..ee36cf500 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -294,14 +294,16 @@ class AuthControllerCore extends FrontController $this->context->customer = $customer; if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0)) + { $this->context->cookie->id_cart = (int)Cart::lastNoneOrderedCart($this->context->customer->id); - - // Update cart address - $this->context->cart->id = $this->context->cookie->id_cart; - $this->context->cart->setDeliveryOption(null); - $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id)); - - $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id)); + $this->context->cart = new Cart((int)$this->context->cookie->id_cart); + } + else + { + $this->context->cart->setDeliveryOption(null); + $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id)); + $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id)); + } $this->context->cart->secure_key = $customer->secure_key; $this->context->cart->update(); $this->context->cart->autosetProductAddress();