// BugFix : Display errors when no carriers available

This commit is contained in:
mDeflotte
2011-12-12 10:21:56 +00:00
parent cf06d1eb92
commit ac24656af1
6 changed files with 33 additions and 5 deletions
+4
View File
@@ -185,6 +185,10 @@ class OrderControllerCore extends ParentOrderController
if ($this->step >= 2 && (!$this->context->cart->id_address_delivery || !$this->context->cart->id_address_invoice))
Tools::redirect('index.php?controller=order&step=1');
if ($this->step > 2 && !$isVirtualCart && count($this->context->cart->getDeliveryOptionList()) == 0)
Tools::redirect('index.php?controller=order&step=2');
$delivery = new Address((int)$this->context->cart->id_address_delivery);
$invoice = new Address((int)$this->context->cart->id_address_invoice);
+7
View File
@@ -393,6 +393,13 @@ class OrderOpcControllerCore extends ParentOrderController
$address_invoice = ($this->context->cart->id_address_delivery == $this->context->cart->id_address_invoice ? $address_delivery : new Address($this->context->cart->id_address_invoice));
if (!$this->context->cart->id_address_delivery OR !$this->context->cart->id_address_invoice OR !Validate::isLoadedObject($address_delivery) OR !Validate::isLoadedObject($address_invoice) OR $address_invoice->deleted OR $address_delivery->deleted)
return '<p class="warning">'.Tools::displayError('Error: please choose an address').'</p>';
if (count($this->context->cart->getDeliveryOptionList()) == 0)
{
if ($this->context->cart->isMultiAddressDelivery())
return '<p class="warning">'.Tools::displayError('Error: There are no carriers available that deliver to some of your addresses').'</p>';
else
return '<p class="warning">'.Tools::displayError('Error: There are no carriers available that deliver to this address').'</p>';
}
if (!$this->context->cart->getDeliveryOption() AND !$this->context->cart->isVirtualCart())
return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>';
if (!$this->context->cart->id_currency)
+6 -4
View File
@@ -394,20 +394,22 @@ class ParentOrderControllerCore extends FrontController
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
$carriers = $this->context->cart->simulateCarriersOutput();
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
$this->context->smarty->assign(array(
'address_collection' => $this->context->cart->getAddressCollection(),
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option_list' => $delivery_option_list,
'carriers' => $carriers,
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'checked' => $checked,
'delivery_option' => $this->context->cart->getDeliveryOption()
));
$this->context->smarty->assign(array(
'HOOK_EXTRACARRIER' => Hook::exec('extraCarrier', array('address' => $address)),
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
'carriers' => $carriers,
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'checked' => $checked,
'delivery_option_list' => $delivery_option_list,
'delivery_option' => $this->context->cart->getDeliveryOption()
))
));