modif expedition

This commit is contained in:
Marion Muszynski 2016-10-20 13:48:55 +02:00
parent 9edcc64a82
commit 302ba040d1

View File

@ -463,8 +463,8 @@ class AdminPrivateSalesSales extends AdminTab {
WHERE c.`deleted` != 1
');
// $carriers_default = array(22, 87, 88, 89); // prod
$carriers_default = array(22, 45, 47, 48); // dev
// $carriers_default = array(87, 88, 89); // prod
$carriers_default = array(45, 47, 48); // dev
echo '<label>'.$this->l('Carriers:').'</label>
<div class="margin-form">
@ -473,10 +473,9 @@ class AdminPrivateSalesSales extends AdminTab {
<option value="0">'.$this->l('Select Expedition').'</option>
<option value="1">'.$this->l('Expédition classique').'</option>
<option value="2">'.$this->l('Expédition domicile uniquement').'</option>
<option value="3">'.$this->l('Expédition gratuite').'</option>
<option value="4">'.$this->l('Expédition gratuite domicile uniquement').'</option>
<option value="3">'.$this->l('Expédition dropshipping').'</option>
</select>
<div class="carriers_info">
<div class="carriers_info" '.(($cookie->id_employee == 1)?'':'style="display:none;"').'>
<h3>'.$this->l('Transporteurs selectionnés : ').'</h3>
<div class="info"></div>
</div>
@ -493,11 +492,20 @@ class AdminPrivateSalesSales extends AdminTab {
echo '</div></div>
<script type="text/javascript">
$(document).ready(function() {
var carriers_selected = [];
var carriers_info = "";
$("input[name=\'m_carriers[]\']:checked").each(function(i, el) {
carriers_info += "<p>"+$(el).data("carrier-name")+"</p>";
carriers_selected.push($(el).val());
});
$(".carriers_info div.info").html(carriers_info);
if (carriers_selected.indexOf("45") && carriers_selected.indexOf("47") && carriers_selected.indexOf("48")) {
$("#delivery_mode option[val=\'1\']").attr("selected", "selected");
} else if (carriers_selected.indexOf("45")) {
$("#delivery_mode option[val=\'2\']").attr("selected", "selected");
} else if (carriers_selected.indexOf("22")) {
("#delivery_mode option[val=\'3\']").attr("selected", "selected");
}
$("#delivery_mode").change(function(){
carriers_info = "";
@ -505,10 +513,12 @@ class AdminPrivateSalesSales extends AdminTab {
$(el).attr("checked",false);
});
var selected_carriers = [];
if($(this).val() == 1 || $(this).val() == 3) {
selected_carriers = ["22", "45", "47", "48"];
} else if($(this).val() == 2 || $(this).val() == 4) {
selected_carriers = ["22", "45"];
if($(this).val() == 1) {
selected_carriers = ["45", "47", "48"];
} else if($(this).val() == 2) {
selected_carriers = ["45"];
} else if($(this).val() == 3) {
selected_carriers = ["22"];
}
$("input[name=\'m_carriers[]\']").each(function(){
if ($.inArray($(this).val(),selected_carriers) != -1){