diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 2e87417c..4c6b6497 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -296,7 +296,7 @@ class HelperFormBootstrap{
"+$(el).data("carrier-name")+"
"; carriers_selected.push($(el).val()); }); + var config_carriers_socol = ['.Configuration::get('ANT_CARRIERS_SOCOL').']; + var is_equal = carriers_selected.length==config_carriers_socol.length && carriers_selected.every(function(v,i) { return ($.inArray(v,config_carriers_socol) != -1)}) $(".carriers_info div.info").html(carriers_info); - if ($.inArray("45",carriers_selected)!= -1 && $.inArray("47",carriers_selected)!= -1 && $.inArray("48",carriers_selected)!= -1) { + if (is_equal) { $("#delivery_mode option[value=\'1\']").attr("selected","selected"); - } else if ($.inArray("45",carriers_selected)!= -1) { + } else if ($.inArray("'.Configuration::get('ANT_CARRIER_DOM').'",carriers_selected)!= -1) { $("#delivery_mode option[value=\'2\']").attr("selected","selected"); - } else if ($.inArray("22",carriers_selected)!= -1) { + } else if ($.inArray("'.Configuration::get('ANT_CARRIER_DROP').'",carriers_selected)!= -1) { $("#delivery_mode option[value=\'3\']").attr("selected","selected"); } @@ -516,11 +518,11 @@ class AdminPrivateSalesSales extends AdminTab { }); var selected_carriers = []; if($(this).val() == 1) { - selected_carriers = ["45", "47", "48"]; + selected_carriers = ["'.str_replace(',','","',Configuration::get('ANT_CARRIERS_SOCOL')).'"]; } else if($(this).val() == 2) { - selected_carriers = ["45"]; + selected_carriers = ["'.Configuration::get('ANT_CARRIER_DOM').'"]; } else if($(this).val() == 3) { - selected_carriers = ["22"]; + selected_carriers = ["'.Configuration::get('ANT_CARRIER_DROP').'"]; } $("input[name=\'m_carriers[]\']").each(function(){ if ($.inArray($(this).val(),selected_carriers) != -1){ diff --git a/override/controllers/ParentOrderController.php b/override/controllers/ParentOrderController.php index 4b1494d6..2ff28bdd 100755 --- a/override/controllers/ParentOrderController.php +++ b/override/controllers/ParentOrderController.php @@ -51,6 +51,8 @@ class ParentOrderController extends ParentOrderControllerCore { $sale_delivery = array(); // Restriction du choix du transporteur if(Module::isInstalled('privatesales')) { + $carrier_dropshipping = (int)Configuration::get('ANT_CARRIER_DROP'); + $carrier_dom = (int)Configuration::get('ANT_CARRIER_DOM'); if(Configuration::get('PRIVATESALES_CARRIERFENCE') ) { $cart_products = self::$cart->getProducts(); if(count($cart_products) > 0) { @@ -82,7 +84,7 @@ class ParentOrderController extends ParentOrderControllerCore { && !in_array($carrier['id_carrier'], $carrier_uniq)) { $_carriers[] = $carrier; $carrier_uniq[] = $carrier['id_carrier']; - if((int)$carrier['id_carrier'] == 22) { + if((int)$carrier['id_carrier'] == $carrier_dropshipping) { $dropshipping = true; } } @@ -153,7 +155,7 @@ class ParentOrderController extends ParentOrderControllerCore { // Gestion carrier socolissimo (soflexibilite) $carriers_socol = array(); foreach ($_carriers as $key => $carrier) { - if($dropshipping && $carrier['id_carrier'] == 22) { + if($dropshipping && $carrier['id_carrier'] == $carrier_dropshipping) { $carrier_drop = $carrier; } if ($carrier['external_module_name'] == "soflexibilite") { @@ -185,24 +187,14 @@ class ParentOrderController extends ParentOrderControllerCore { // distinction "at home" et "out of home" $carriers_ah = array(); $carriers_ooh = array(); - $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_map('intval',explode(',', Configuration::get('ANT_CARRIERS_OOH'))); 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'] != $carrier_dom) { 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 + if($carrier['id_carrier'] != $carrier_dom + && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[$carrier_dom]) + && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[$carrier_dom]) { continue; } if (in_array($carrier['id_carrier'], $config_carrier_ooh) ){