From 6234476bc78ed6a3523bb3a12245c92e68f9d8ae Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Wed, 4 Jan 2017 15:10:09 +0100 Subject: [PATCH 1/3] upgrade emplacement limit --- modules/braderie/AdminBraderie.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/braderie/AdminBraderie.php b/modules/braderie/AdminBraderie.php index 229ada66..d2130cde 100644 --- a/modules/braderie/AdminBraderie.php +++ b/modules/braderie/AdminBraderie.php @@ -172,7 +172,7 @@ class AdminBraderie extends AdminTab var emplacement = $("#input_storage").val(); - if (emplacement.length == 0 || emplacement>205) { + if (emplacement.length == 0 || emplacement>505) { $("#error").empty().append("'.$this->l('L\'emplacement n\'est pas renseigné ou est mal renseigné').'"); return false; } @@ -227,7 +227,7 @@ class AdminBraderie extends AdminTab var emplacement = $("#input_storage").val(); - if (emplacement.length == 0 || emplacement>205) { + if (emplacement.length == 0 || emplacement>505) { $("#error").empty().append("'.$this->l('L\'emplacement n\'est pas renseigné ou est mal renseigné').'"); return false; } From e902c80b60d1203a308850e650feec2c3e2afd63 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 5 Jan 2017 11:18:05 +0100 Subject: [PATCH 2/3] fix for prod --- modules/privatesales/AdminPrivateSalesSales.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 1195b166..68b5b251 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -463,8 +463,8 @@ class AdminPrivateSalesSales extends AdminTab { WHERE c.`deleted` != 1 '); - // $carriers_default = array(87, 88, 89); // prod - $carriers_default = array(45, 47, 48); // dev + $carriers_default = array(87, 88, 89); // prod + // $carriers_default = array(45, 47, 48); // dev echo '
@@ -499,11 +499,9 @@ class AdminPrivateSalesSales extends AdminTab { carriers_selected.push($(el).val()); }); $(".carriers_info div.info").html(carriers_info); - console.log($.inArray("45",carriers_selected)); - if ($.inArray("45",carriers_selected)!= -1 && $.inArray("47",carriers_selected)!= -1 && $.inArray("48",carriers_selected)!= -1) { + if ($.inArray("87",carriers_selected)!= -1 && $.inArray("88",carriers_selected)!= -1 && $.inArray("89",carriers_selected)!= -1) { $("#delivery_mode option[value=\'1\']").attr("selected","selected"); - } else if ($.inArray("45",carriers_selected)!= -1) { - console.log("test"); + } else if ($.inArray("87",carriers_selected)!= -1) { $("#delivery_mode option[value=\'2\']").attr("selected","selected"); } else if ($.inArray("22",carriers_selected)!= -1) { $("#delivery_mode option[value=\'3\']").attr("selected","selected"); @@ -516,9 +514,9 @@ class AdminPrivateSalesSales extends AdminTab { }); var selected_carriers = []; if($(this).val() == 1) { - selected_carriers = ["45", "47", "48"]; + selected_carriers = ["87", "88", "89"]; } else if($(this).val() == 2) { - selected_carriers = ["45"]; + selected_carriers = ["87"]; } else if($(this).val() == 3) { selected_carriers = ["22"]; } From 6cc03d0287f24cabd8aa9543d060949fd38eafc0 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Fri, 6 Jan 2017 16:25:08 +0100 Subject: [PATCH 3/3] restriction with carrier priority --- .../controllers/ParentOrderController.php | 51 ++++++++++++++----- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/override/controllers/ParentOrderController.php b/override/controllers/ParentOrderController.php index 9bd58eaf..bb569d4e 100755 --- a/override/controllers/ParentOrderController.php +++ b/override/controllers/ParentOrderController.php @@ -55,9 +55,11 @@ class ParentOrderController extends ParentOrderControllerCore { $cart_products = self::$cart->getProducts(); if(count($cart_products) > 0) { - $_carriers = array(); $_sales = array(); + $_carriers = array(); $carrier_uniq = array(); + $count_carriers = array(); + $dropshipping = false; $shipping_only_athome = false; foreach ($cart_products as $key => $cart_product) { $sale = Sale::getSaleFromCategory($cart_product['id_category_default']); @@ -80,11 +82,13 @@ class ParentOrderController extends ParentOrderControllerCore { && !in_array($carrier['id_carrier'], $carrier_uniq)) { $_carriers[] = $carrier; $carrier_uniq[] = $carrier['id_carrier']; + if((int)$carrier['id_carrier'] == 22) { + $dropshipping = true; + } } } } } - // si multiple vente dont vente consommables foreach ($_sales as $key => $carriers) { if ((int) $key == _SHOP_PRIVATESALES_CONSUMABLE) { @@ -106,8 +110,16 @@ class ParentOrderController extends ParentOrderControllerCore { } elseif (count($_sales)==1) { // $carrier_shipping_cost = 5; } + } else { + foreach ($carriers as $key => $value) { + if(isset($count_carriers[(int)$value])) { + $count_carriers[(int)$value]++; + } else { + $count_carriers[(int)$value] = 1; + } + } } - } + } // si multiple carriers if (count($_carriers) > 1) { @@ -141,11 +153,17 @@ class ParentOrderController extends ParentOrderControllerCore { // Gestion carrier socolissimo (soflexibilite) $carriers_socol = array(); foreach ($_carriers as $key => $carrier) { + if($dropshipping && $carrier['id_carrier'] == 22) { + $carrier_drop = $carrier; + } if ($carrier['external_module_name'] == "soflexibilite") { $carriers_socol[] = $carrier; } } - if (!empty($carriers_socol)){ + if(isset($carrier_drop) && !$shipping_only_athome) { + unset($carriers); + $carriers[0] = $carrier_drop; + } elseif (!empty($carriers_socol)){ unset($carriers); $carriers = $carriers_socol; } else { @@ -164,17 +182,27 @@ class ParentOrderController extends ParentOrderControllerCore { } else { $carriers = $_carriers; } - // distinction "at home" et "out of home" $carriers_ah = array(); $carriers_ooh = array(); - $config_carrier_ooh = array(88,89); // prod + //$config_carrier_ooh = array(88,89); // prod // $config_carrier_ooh = array(47,48); // dev - // $config_carrier_ooh = array(40,45); // local + $config_carrier_ooh = array(40,45); // local foreach ($carriers as $carrier) { - if($shipping_only_athome && $carrier['id_carrier'] != 87) { // prod - // if($shipping_only_athome && $carrier['id_carrier'] != 45) { // dev - // if($shipping_only_athome && $carrier['id_carrier'] != 38) { // local + //if($shipping_only_athome && $carrier['id_carrier'] != 87) { // prod + if($shipping_only_athome && $carrier['id_carrier'] != 45) { // dev + //if($shipping_only_athome && $carrier['id_carrier'] != 38) { // local + continue; + } + // if($carrier['id_carrier'] != 87 + // && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[87]) + // && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[87]) { // prod + if($carrier['id_carrier'] != 45 + && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[45]) + && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[45]) { // dev + // if($carrier['id_carrier'] != 38 + // && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[38]) + // && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[38]) { //local continue; } if (in_array($carrier['id_carrier'], $config_carrier_ooh) ){ @@ -183,11 +211,10 @@ class ParentOrderController extends ParentOrderControllerCore { $carriers_ah[] = $carrier; } } - // fix a check ! if (count($carriers_ah) > 0) { unset($carriers); - $carriers = $carriers_ah; + $carriers = $carriers_ah; } }