From b67a78f9dd1fa10ee68928d70aab71ada549b61a Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 15 Oct 2013 14:53:44 +0200 Subject: [PATCH] [-] Fo : Fix bug #PSCFV-10640, redirect loop when country address is not among active countries in OPC --- controllers/front/ParentOrderController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 15d8e4289..097aa2f7d 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -464,8 +464,17 @@ class ParentOrderControllerCore extends FrontController { $address = new Address($this->context->cart->id_address_delivery); $id_zone = Address::getZoneById($address->id); - if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)($this->context->cart->id_address_invoice))) - Tools::redirect('index.php?controller=order&step=1'); + $bad_delivery = false; + if ($bad_delivery = !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();