fix conflict and attribute value for dev

This commit is contained in:
Marion Muszynski 2017-01-06 16:27:25 +01:00
commit ebcd9d6f39
3 changed files with 43 additions and 17 deletions

View File

@ -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;
}

View File

@ -465,7 +465,7 @@ class AdminPrivateSalesSales extends AdminTab {
WHERE c.`deleted` != 1
');
// $carriers_default = array(87, 88, 89); // prod
//$carriers_default = array(87, 88, 89); // prod
$carriers_default = array(45, 47, 48); // dev
echo '<label>'.$this->l('Carriers:').'</label>
@ -501,11 +501,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) {
$("#delivery_mode option[value=\'1\']").attr("selected","selected");
} else if ($.inArray("45",carriers_selected)!= -1) {
console.log("test");
$("#delivery_mode option[value=\'2\']").attr("selected","selected");
} else if ($.inArray("22",carriers_selected)!= -1) {
$("#delivery_mode option[value=\'3\']").attr("selected","selected");
@ -684,6 +682,7 @@ class AdminPrivateSalesSales extends AdminTab {
$('.list_vente').empty();
var loader = "<p style='text-align:center'><img src='../img/loader_payment.gif' /></p>";
$('.list_vente').html(loader);
$.ajax({

View File

@ -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;
}
}