Merge branch 'ticket-ChangeDeliveryAddress' into develop

This commit is contained in:
Marion Muszynski 2016-10-14 14:00:04 +02:00
commit 0989a6633a

View File

@ -70,8 +70,28 @@ if ($cookie->isLogged()) {
);
}
if($newAddressId) {
$order->id_address_delivery = (int)$newAddressId;
$order->update();
$errors = array();
$delivery = new Address((int)$newAddressId);
$prefix_postcode = substr($delivery->postcode, 0 ,2);
if ($delivery->id_country == 6
&& (intval($prefix_postcode) == 35 || intval($prefix_postcode) == 38)
) {
$errors[] = Tools::displayError('Lo sentimos, en estos momentos no distribuimos nuestros productos en Canarias. Si deseas más información, puedes contactar con el Servicio de atención al cliente o llamar al 902 044 399.');
}
// bloque DOM-TOM
$prefix_postcode = substr($delivery->postcode, 0 ,3);
$domtom = array(971,972,973,974,975,976,984,986,987,988);
if ($delivery->id_country == 8 && (in_array(intval($prefix_postcode),$domtom))
) {
$errors[] = Tools::displayError('Nous sommes désolé, nous ne livrons pas dans le DOM-TOM');
}
if (empty($errors)) {
$order->id_address_delivery = (int)$newAddressId;
$order->update();
}
}
} else {
$errors[] = Tools::displayError('An error occured');