// BugFix : Display errors when no carriers available
This commit is contained in:
@@ -2280,6 +2280,9 @@ class AdminControllerCore extends Controller
|
||||
$assos = $assos_data[0];
|
||||
$type = $assos_data[1];
|
||||
|
||||
if (!$type)
|
||||
return;
|
||||
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||
|
||||
foreach ($assos as $asso)
|
||||
|
||||
@@ -1607,6 +1607,7 @@ class CartCore extends ObjectModel
|
||||
* ),
|
||||
* ),
|
||||
* );
|
||||
* If there are no carriers available for an address, return an empty array
|
||||
*/
|
||||
public function getDeliveryOptionList(Country $default_country = null, $flush = false)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
))
|
||||
));
|
||||
|
||||
@@ -180,8 +180,17 @@
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{foreachelse}
|
||||
<p class="warning" id="noCarrierWarning">
|
||||
{if $cart->isMultiAddressDelivery()}
|
||||
{l s='There are no carriers available that deliver to some of your addresses.'}
|
||||
{else}
|
||||
{l s='There are no carriers available that deliver to this address.'}
|
||||
{/if}
|
||||
</p>
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
<div style="display: none;" id="extra_carrier"></div>
|
||||
|
||||
@@ -231,7 +240,9 @@
|
||||
{else}
|
||||
<a href="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
|
||||
{/if}
|
||||
<input type="submit" name="processCarrier" value="{l s='Next'} »" class="exclusive" />
|
||||
{if $virtual_cart || (isset($delivery_option_list) && !empty($delivery_option_list))}
|
||||
<input type="submit" name="processCarrier" value="{l s='Next'} »" class="exclusive" />
|
||||
{/if}
|
||||
</p>
|
||||
</form>
|
||||
{else}
|
||||
|
||||
Reference in New Issue
Block a user