1$(document).ready(function(){ 2 $('span.add-to-carton').on('click', function() { 3 venteCartonInit(this,"1"); 4 }); 5 $(document).on('click', '.product-variants .custom-radio', function(){ 6 //venteCartonInit(this,"2"); 7 }); 8 9 $('.product-variants input:checked').parent().trigger('click'); 10 11 if ($('button.add-to-cart').prop('disabled') == true) { 12 $('span.add-to-carton').hide(); 13 } 14 15 prestashop.on('updatedProduct', (args) => { 16 venteCartonInit(this,"1"); 17 }); 18 19}); 20 21const venteCartonInit = (el) => { 22 idCombination = $('.product-variants input:checked').val(); 23 $.ajax({ 24 type: "POST", 25 url: $(el).data('url'), 26 data: { 27 "id_product_attribute": idCombination, 28 "id_product": $(el).data('id-product') 29 }, 30 success: function(result) { 31 if (parseInt(result) > 1 && ($('input#quantity_wanted').val() > 1 || $('input#quantity_wanted').val() < 1)) { 32 $('input#quantity_wanted').val(parseInt($('input#quantity_wanted').val())+parseInt(result)); 33 } else if (parseInt(result) > 1 && $('input#quantity_wanted').val() == 1) { 34 $('input#quantity_wanted').val(parseInt($('input#quantity_wanted').val())+parseInt(result)-1); 35 } 36 }, 37 error: function(result) {} 38 }); 39 $.ajax({
40 type: "POST", 41 url: $('span.add-to-carton').data('url'), 42 data: { 43 "id_product_attribute": $(el).children('input').val(), 44 "id_product": $('span.add-to-carton').data('id-product') 45 }, 46 success: function(result) { 47 if (parseInt(result) == 0) { 48 $('span.add-to-carton').hide(); 49 } else { 50 $('span.add-to-carton').show(); 51 } 52 }, 53 error: function(result) {} 54 }); 55 $('.product-variants input:checked').parent().trigger('click'); 56 if ($('button.add-to-cart').prop('disabled') == true) { 57 $('span.add-to-carton').hide(); 58 } 59}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.