Exchange order pack first, single after
This commit is contained in:
parent
ee76fb5feb
commit
a348fd8328
@ -272,64 +272,62 @@ function checkEAN() {
|
||||
ean_timeout = setTimeout(function() {
|
||||
var eanval = $("#eaninput").val();
|
||||
if (eanval != "") {
|
||||
/* Select simple product */
|
||||
var eanval_item = $("#button_form tbody tr").filter(function() {
|
||||
if ($(this).attr("rel") != eanval) {
|
||||
return $(this).attr("rel") == '0'+eanval;
|
||||
/* Select pack product */
|
||||
var eanval_item_pack = $("#button_form tbody tr").filter(function() {
|
||||
if ($(this).attr("rel") != eanval+'_pack') {
|
||||
return $(this).attr("rel") == '0'+eanval+'_pack';
|
||||
}
|
||||
return $(this).attr("rel") == eanval;
|
||||
});
|
||||
if (eanval_item.length > 0) {
|
||||
$(eanval_item).each(function(id, el) {
|
||||
var current_val = parseInt($(el).find(".shipped input").val());
|
||||
var max_val = parseInt($(el).find(".toship strong").text());
|
||||
return $(this).attr("rel") == eanval+'_pack';
|
||||
});
|
||||
if (eanval_item_pack.length > 0) {
|
||||
$(eanval_item_pack).each(function(id_pack, el_pack) {
|
||||
var current_val = parseInt($(el_pack).find(".shipped input").val());
|
||||
var max_val = parseInt($(el_pack).find(".toship strong").text());
|
||||
if (current_val < max_val) {
|
||||
qtyUp($(el).find(".shipped a")[0], max_val);
|
||||
qtyUp($(el_pack).find(".shipped a")[0], max_val);
|
||||
} else {
|
||||
var eanval_item_pack = $("#button_form tbody tr").filter(function() {
|
||||
if ($(this).attr("rel") != eanval+'_pack') {
|
||||
return $(this).attr("rel") == '0'+eanval+'_pack';
|
||||
var eanval_item = $("#button_form tbody tr").filter(function() {
|
||||
if ($(this).attr("rel") != eanval) {
|
||||
return $(this).attr("rel") == '0'+eanval;
|
||||
}
|
||||
return $(this).attr("rel") == eanval+'_pack';
|
||||
return $(this).attr("rel") == eanval;
|
||||
});
|
||||
if (eanval_item_pack.length > 0) {
|
||||
$(eanval_item_pack).each(function(id_pack, el_pack) {
|
||||
var current_val = parseInt($(el_pack).find(".shipped input").val());
|
||||
var max_val = parseInt($(el_pack).find(".toship strong").text());
|
||||
if (eanval_item.length > 0) {
|
||||
$(eanval_item).each(function(id, el) {
|
||||
var current_val = parseInt($(el).find(".shipped input").val());
|
||||
var max_val = parseInt($(el).find(".toship strong").text());
|
||||
if (current_val < max_val) {
|
||||
qtyUp($(el_pack).find(".shipped a")[0], max_val);
|
||||
qtyUp($(el).find(".shipped a")[0], max_val);
|
||||
} else {
|
||||
confirm("Quantité à envoyer déjà atteinte pour ce produit");
|
||||
confirm("Quantité à envoyer déjà atteinte pour ce produit");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
confirm("Quantité à envoyer déjà atteinte pour ce produit");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/* Select pack product */
|
||||
/* Select simple product */
|
||||
else {
|
||||
var eanval_item_pack = $("#button_form tbody tr").filter(function() {
|
||||
if ($(this).attr("rel") != eanval+'_pack') {
|
||||
return $(this).attr("rel") == '0'+eanval+'_pack';
|
||||
var eanval_item = $("#button_form tbody tr").filter(function() {
|
||||
if ($(this).attr("rel") != eanval) {
|
||||
return $(this).attr("rel") == '0'+eanval;
|
||||
}
|
||||
return $(this).attr("rel") == eanval+'_pack';
|
||||
});
|
||||
if (eanval_item_pack.length > 0) {
|
||||
$(eanval_item_pack).each(function(id_pack, el_pack) {
|
||||
var current_val = parseInt($(el_pack).find(".shipped input").val());
|
||||
var max_val = parseInt($(el_pack).find(".toship strong").text());
|
||||
return $(this).attr("rel") == eanval;
|
||||
});
|
||||
if (eanval_item.length > 0) {
|
||||
$(eanval_item).each(function(id, el) {
|
||||
var current_val = parseInt($(el).find(".shipped input").val());
|
||||
var max_val = parseInt($(el).find(".toship strong").text());
|
||||
if (current_val < max_val) {
|
||||
qtyUp($(el_pack).find(".shipped a")[0], max_val);
|
||||
qtyUp($(el).find(".shipped a")[0], max_val);
|
||||
} else {
|
||||
confirm("Quantité à envoyer déjà atteinte pour ce produit");
|
||||
confirm("Quantité à envoyer déjà atteinte pour ce produit");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
confirm("Aucun produit avec cet EAN13 ne figure dans cette commande");
|
||||
confirm("Aucun produit avec cet EAN13 ne figure dans cette commande");
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#eaninput").val("");
|
||||
}
|
||||
}, 200);
|
||||
|
Loading…
Reference in New Issue
Block a user