[-] FO : #PSCFV-2158 - Add warning message when a product cannot be delivered to an address
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15021 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -126,6 +126,12 @@ class CartControllerCore extends FrontController
|
||||
$old_id_address_delivery = (int)Tools::getValue('old_id_address_delivery');
|
||||
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
|
||||
|
||||
if (!count(Carrier::getAvailableCarrierList(new Product($this->id_product), null, $new_id_address_delivery)))
|
||||
die(Tools::jsonEncode(array(
|
||||
'hasErrors' => true,
|
||||
'error' => Tools::displayError('It\'s not possible to deliver this product to the selected address.', false),
|
||||
)));
|
||||
|
||||
$this->context->cart->setProductAddressDelivery(
|
||||
$this->id_product,
|
||||
$this->id_product_attribute,
|
||||
|
||||
@@ -238,9 +238,16 @@ class OrderControllerCore extends ParentOrderController
|
||||
$this->context->cart->setNoMultishipping();
|
||||
|
||||
// Add checking for all addresses
|
||||
|
||||
if (!Tools::isSubmit('id_address_delivery') || !Address::isCountryActiveById((int)Tools::getValue('id_address_delivery')))
|
||||
$this->errors[] = Tools::displayError('This address is not in a valid area.');
|
||||
$address_without_carriers = $this->context->cart->getDeliveryAddressesWithoutCarriers();
|
||||
if (count($address_without_carriers))
|
||||
{
|
||||
if (count($address_without_carriers) > 1)
|
||||
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to some addresses you selected.'));
|
||||
elseif ($this->context->cart->isMultiAddressDelivery())
|
||||
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to one of the address you selected.'));
|
||||
else
|
||||
$this->errors[] = sprintf(Tools::displayError('There are no carriers that deliver to the address you selected.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->context->cart->id_address_delivery = (int)Tools::getValue('id_address_delivery');
|
||||
|
||||
@@ -197,7 +197,6 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$result = $this->_getCarrierList();
|
||||
// Wrapping fees
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
|
||||
@@ -213,7 +212,10 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
}
|
||||
}
|
||||
if (count($this->errors))
|
||||
die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}');
|
||||
die(Tools::jsonEncode(array(
|
||||
'hasError' => true,
|
||||
'errors' => $this->errors
|
||||
)));
|
||||
}
|
||||
die(Tools::displayError());
|
||||
break;
|
||||
@@ -504,7 +506,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
if (count($this->errors))
|
||||
return array(
|
||||
'hasError' => true,
|
||||
'errors' => $this->errors
|
||||
'errors' => $this->errors,
|
||||
'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-carrier.tpl')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user