[-] FO : Fix #PSCFV-6356 recall adresses in cart after login

This commit is contained in:
Gregory Roussac
2013-01-28 18:29:35 +01:00
parent 715ccbcf72
commit dce6247c0c
+9 -7
View File
@@ -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();