From 28d9b3cb2b297db9feaefbb87ddcbdc9fc38d617 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Mon, 1 Oct 2012 14:35:34 +0000 Subject: [PATCH] // Fix #PSCFV-4562 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17650 b9a71923-0436-4b27-9f14-aed3839534dd --- controllers/front/AddressController.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index ce226b184..029625ed4 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -76,16 +76,21 @@ class AddressControllerCore extends FrontController { if (Tools::isSubmit('delete')) { - if ($this->context->cart->id_address_invoice == $this->_address->id) - unset($this->context->cart->id_address_invoice); - if ($this->context->cart->id_address_delivery == $this->_address->id) - unset($this->context->cart->id_address_delivery); if ($this->_address->delete()) + { + if ($this->context->cart->id_address_invoice == $this->_address->id) + unset($this->context->cart->id_address_invoice); + if ($this->context->cart->id_address_delivery == $this->_address->id) + { + unset($this->context->cart->id_address_delivery); + $this->context->cart->updateAddressId($this->_address->id, (int)Address::getFirstCustomerAddressId(Context::getContext()->customer->id)); + } Tools::redirect('index.php?controller=addresses'); + } $this->errors[] = Tools::displayError('This address cannot be deleted.'); } } - else if ($this->ajax) + elseif ($this->ajax) exit; else Tools::redirect('index.php?controller=addresses');