Merge branch 'ticket-ChangeDeliveryAddress' into develop
This commit is contained in:
commit
f1e58c8551
@ -23,18 +23,21 @@ if($cookie->isLogged() && Tools::getValue('id_order')) {
|
||||
}
|
||||
|
||||
if(Tools::getValue('getAD')
|
||||
&& ($id_address = Tools::getValue('id_address'))) {
|
||||
&& ($id_address = Tools::getValue('id_address'))
|
||||
&& ($id_cart = Tools::getValue('id_cart'))) {
|
||||
$errors = array();
|
||||
$order_cart = new Cart((int)$id_cart);
|
||||
$delivery = new Address((int)$id_address);
|
||||
$prefix_postcode = substr($delivery->postcode, 0 ,2);
|
||||
|
||||
// Checking CANARIES
|
||||
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
|
||||
// Checking DOM-TOM
|
||||
$prefix_postcode = substr($delivery->postcode, 0 ,3);
|
||||
$domtom = array(971,972,973,974,975,976,984,986,987,988);
|
||||
|
||||
@ -43,6 +46,17 @@ if($cookie->isLogged() && Tools::getValue('id_order')) {
|
||||
$errors[] = Tools::displayError('Nous sommes désolé, nous ne livrons pas dans le DOM-TOM');
|
||||
}
|
||||
|
||||
// Checking only in france
|
||||
$products_only_fr = array();
|
||||
foreach($order_cart->getProducts() as $product) {
|
||||
if(($sale = Sale::getSaleFromCategory($product['id_category_default'])) !== NULL) {
|
||||
// shipping only in france
|
||||
if($sale->shipping_fr == 1 && $delivery->id_country != 8) {
|
||||
$errors[] = Tools::displayError('Votre commande contient des produits expédiés uniquement en France');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
$change_address = $ant_changeaddress->getAddress($id_address);
|
||||
$html = '';
|
||||
|
@ -74,20 +74,32 @@ if ($cookie->isLogged()) {
|
||||
$delivery = new Address((int)$newAddressId);
|
||||
$prefix_postcode = substr($delivery->postcode, 0 ,2);
|
||||
|
||||
// Checking CANARIES
|
||||
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
|
||||
// Checking 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');
|
||||
}
|
||||
|
||||
// Checking only in france
|
||||
$products_only_fr = array();
|
||||
foreach($order_cart->getProducts() as $product) {
|
||||
if(($sale = Sale::getSaleFromCategory($product['id_category_default'])) !== NULL) {
|
||||
// shipping only in france
|
||||
if($sale->shipping_fr == 1 && $delivery->id_country != 8) {
|
||||
$errors[] = Tools::displayError('Votre commande contient des produits expédiés uniquement en France');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$order->id_address_delivery = (int)$newAddressId;
|
||||
$order->update();
|
||||
|
@ -305,16 +305,20 @@
|
||||
id_order : {/literal}{$order->id}{literal},
|
||||
getAD : 1,
|
||||
id_address : id_address,
|
||||
id_cart : {/literal}{$order->id_cart}{literal},
|
||||
token : static_token
|
||||
},
|
||||
success: function(jsonData) {
|
||||
$("div.error").hide();
|
||||
if(jsonData.error == "false") {
|
||||
$("p.error").hide();
|
||||
$("ul.address_box").empty();
|
||||
$("ul.address_box").html(jsonData.text);
|
||||
$("input[name='submitChangeAddress']").show();
|
||||
} else{
|
||||
$("p.error").html(jsonData.text);
|
||||
$("p.error").show();
|
||||
$("input[name='submitChangeAddress']").hide();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get update address \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||
|
Loading…
Reference in New Issue
Block a user