// BugFix : Display errors when no carriers available
This commit is contained in:
1 parent
cf06d1eb92
commit
ac24656af1
6 files changed
+33
-5
No files matched your search
@@ -2280,6 +2280,9 @@ class AdminControllerCore extends Controller
|
|||||||
$assos = $assos_data[0];
|
$assos = $assos_data[0];
|
||||||
$type = $assos_data[1];
|
$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 : ''));
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||||
|
|
||||||
foreach ($assos as $asso)
|
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)
|
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))
|
if ($this->step >= 2 && (!$this->context->cart->id_address_delivery || !$this->context->cart->id_address_invoice))
|
||||||
Tools::redirect('index.php?controller=order&step=1');
|
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);
|
$delivery = new Address((int)$this->context->cart->id_address_delivery);
|
||||||
$invoice = new Address((int)$this->context->cart->id_address_invoice);
|
$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));
|
$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)
|
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>';
|
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())
|
if (!$this->context->cart->getDeliveryOption() AND !$this->context->cart->isVirtualCart())
|
||||||
return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>';
|
return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>';
|
||||||
if (!$this->context->cart->id_currency)
|
if (!$this->context->cart->id_currency)
|
||||||
|
|||||||
@@ -394,20 +394,22 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
$address = new Address($this->context->cart->id_address_delivery);
|
$address = new Address($this->context->cart->id_address_delivery);
|
||||||
$id_zone = Address::getZoneById($address->id);
|
$id_zone = Address::getZoneById($address->id);
|
||||||
$carriers = $this->context->cart->simulateCarriersOutput();
|
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||||
|
$checked = $this->context->cart->simulateCarrierSelectedOutput();
|
||||||
|
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'address_collection' => $this->context->cart->getAddressCollection(),
|
'address_collection' => $this->context->cart->getAddressCollection(),
|
||||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
'delivery_option_list' => $delivery_option_list,
|
||||||
'carriers' => $carriers,
|
'carriers' => $carriers,
|
||||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
'checked' => $checked,
|
||||||
'delivery_option' => $this->context->cart->getDeliveryOption()
|
'delivery_option' => $this->context->cart->getDeliveryOption()
|
||||||
));
|
));
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'HOOK_EXTRACARRIER' => Hook::exec('extraCarrier', array('address' => $address)),
|
'HOOK_EXTRACARRIER' => Hook::exec('extraCarrier', array('address' => $address)),
|
||||||
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
|
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
|
||||||
'carriers' => $carriers,
|
'carriers' => $carriers,
|
||||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
'checked' => $checked,
|
||||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
'delivery_option_list' => $delivery_option_list,
|
||||||
'delivery_option' => $this->context->cart->getDeliveryOption()
|
'delivery_option' => $this->context->cart->getDeliveryOption()
|
||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -180,8 +180,17 @@
|
|||||||
</div>
|
</div>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</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}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style="display: none;" id="extra_carrier"></div>
|
<div style="display: none;" id="extra_carrier"></div>
|
||||||
|
|
||||||
@@ -231,7 +240,9 @@
|
|||||||
{else}
|
{else}
|
||||||
<a href="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
|
<a href="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
|
||||||
{/if}
|
{/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>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
{else}
|
{else}
|
||||||
|
|||||||
Reference in new issue
Block a user