[-] FO : fix #PSCFV-6165 cart update when inactive country in old address

This commit is contained in:
gRoussac committed 2013-01-09 18:23:40 +01:00
1 parent 84b6222de1
commit ffa3be6e89
1 file changed
+11 -13
+11 -13
View File
@@ -254,19 +254,6 @@ class OrderControllerCore extends ParentOrderController
|| (Tools::isSubmit('same') && !Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_invoice')))) || (Tools::isSubmit('same') && !Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_invoice'))))
$this->errors[] = Tools::displayError('Invalid address', !Tools::getValue('ajax')); $this->errors[] = Tools::displayError('Invalid address', !Tools::getValue('ajax'));
else else
{
// Add checking for all addresses
$address_without_carriers = $this->context->cart->getDeliveryAddressesWithoutCarriers();
if (count($address_without_carriers))
{
if (count($address_without_carriers) > 1)
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to some addresses you selected.', !Tools::getValue('ajax')));
elseif ($this->context->cart->isMultiAddressDelivery())
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to one of the address you selected.', !Tools::getValue('ajax')));
else
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to the address you selected.', !Tools::getValue('ajax')));
}
else
{ {
$this->context->cart->id_address_delivery = (int)Tools::getValue('id_address_delivery'); $this->context->cart->id_address_delivery = (int)Tools::getValue('id_address_delivery');
$this->context->cart->id_address_invoice = Tools::isSubmit('same') ? $this->context->cart->id_address_delivery : (int)Tools::getValue('id_address_invoice'); $this->context->cart->id_address_invoice = Tools::isSubmit('same') ? $this->context->cart->id_address_delivery : (int)Tools::getValue('id_address_invoice');
@@ -282,6 +269,17 @@ class OrderControllerCore extends ParentOrderController
if (Tools::isSubmit('message')) if (Tools::isSubmit('message'))
$this->_updateMessage(Tools::getValue('message')); $this->_updateMessage(Tools::getValue('message'));
// Add checking for all addresses
$address_without_carriers = $this->context->cart->getDeliveryAddressesWithoutCarriers();
if (count($address_without_carriers))
{
if (count($address_without_carriers) > 1)
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to some addresses you selected.', !Tools::getValue('ajax')));
elseif ($this->context->cart->isMultiAddressDelivery())
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to one of the address you selected.', !Tools::getValue('ajax')));
else
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to the address you selected.', !Tools::getValue('ajax')));
} }
} }