// Fix #PSCFV-4562

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17650 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-10-01 14:35:34 +00:00
parent 1096d7dc44
commit 28d9b3cb2b
+7 -2
View File
@@ -75,17 +75,22 @@ class AddressControllerCore extends FrontController
if (Validate::isLoadedObject($this->_address) && Customer::customerHasAddress($this->context->customer->id, $id_address)) if (Validate::isLoadedObject($this->_address) && Customer::customerHasAddress($this->context->customer->id, $id_address))
{ {
if (Tools::isSubmit('delete')) if (Tools::isSubmit('delete'))
{
if ($this->_address->delete())
{ {
if ($this->context->cart->id_address_invoice == $this->_address->id) if ($this->context->cart->id_address_invoice == $this->_address->id)
unset($this->context->cart->id_address_invoice); unset($this->context->cart->id_address_invoice);
if ($this->context->cart->id_address_delivery == $this->_address->id) if ($this->context->cart->id_address_delivery == $this->_address->id)
{
unset($this->context->cart->id_address_delivery); unset($this->context->cart->id_address_delivery);
if ($this->_address->delete()) $this->context->cart->updateAddressId($this->_address->id, (int)Address::getFirstCustomerAddressId(Context::getContext()->customer->id));
}
Tools::redirect('index.php?controller=addresses'); Tools::redirect('index.php?controller=addresses');
}
$this->errors[] = Tools::displayError('This address cannot be deleted.'); $this->errors[] = Tools::displayError('This address cannot be deleted.');
} }
} }
else if ($this->ajax) elseif ($this->ajax)
exit; exit;
else else
Tools::redirect('index.php?controller=addresses'); Tools::redirect('index.php?controller=addresses');