[*] FO : Redirect to address.tpl when !Address::isCountryActiveById

This commit is contained in:
gRoussac
2013-11-12 12:12:19 +01:00
parent 0e1898be09
commit 3f42a381a4
+11 -10
View File
@@ -415,6 +415,17 @@ class ParentOrderControllerCore extends FrontController
if (key($customerAddresses) != 0)
$customerAddresses = array_values($customerAddresses);
if (!count($customerAddresses))
{
$bad_delivery = false;
if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)))
{
$back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping')));
$params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url);
Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params));
}
}
$this->context->smarty->assign(array(
'addresses' => $customerAddresses,
'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList));
@@ -465,16 +476,6 @@ class ParentOrderControllerCore extends FrontController
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
$bad_delivery = false;
if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)))
{
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 && Dispatcher::getInstance()->getController() != 'order-opc')
{
$back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping')));
$params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url);
Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params));
}
Tools::redirect('index.php?controller=order&step=1');
}
$carriers = $this->context->cart->simulateCarriersOutput();
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$delivery_option_list = $this->context->cart->getDeliveryOptionList();