1/** 2* NOTICE OF LICENSE 3* 4* This product is licensed for one customer to use on one installation (test stores and multishop included). 5* Site developer has the right to modify this module to suit their needs, but can not redistribute the module in 6* whole or in part. Any other use of this module constitues a violation of the user agreement. 7* 8* DISCLAIMER 9* 10* NO WARRANTIES OF DATA SAFETY OR MODULE SECURITY 11* ARE EXPRESSED OR IMPLIED. USE THIS MODULE IN ACCORDANCE 12* WITH YOUR MERCHANT AGREEMENT, KNOWING THAT VIOLATIONS OF 13* PCI COMPLIANCY OR A DATA BREACH CAN COST THOUSANDS OF DOLLARS 14* IN FINES AND DAMAGE A STORES REPUTATION. USE AT YOUR OWN RISK. 15* 16* @author idnovate.com <[email protected]> 17* @copyright 2022 idnovate.com 18* @license See above 19*/ 20 21if (typeof updateCartSummary === 'function') { 22 updateCartSummary = (function() { 23 var updateCartSummaryCached = updateCartSummary; 24 25 return function(json) { 26 updateCartSummaryCached.apply(this, arguments); 27 28 if (json && !$.isEmptyObject(json.discounts)) { 29 for (i=0; i<json.discounts.length; i++) { 30 if ($('#cart_discount_' + json.discounts[i].id_cart_rule).length === 0) { 31 if (priceDisplayMethod !== 0) 32 var discountedPrice = formatCurrency(json.discounts[i].value_tax_exc * -1, currencyFormat, currencySign, currencyBlank); 33 else 34 discountedPrice = formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank); 35 36 if ($('.cart-summary').length) { 37 var discountTd = " \ 38 <li class='cart_discount cart-summary-line clearfix' id='cart_discount_"+json.discounts[i].id_cart_rule+"'> \ 39 <span class='cart_discount_name'>"+json.discounts[i].name+"</span>\ 40 <span class='cart_discount_price value float-right'>"+discountedPrice+"</span>\ 41 </li>"; 42 43 $('.promo-name').append(discountTd); 44 } else if ($('#cart_summary').length) { 45 var discountTd = " \ 46 <tbody> \ 47 <tr class='cart_discount last_item' id='cart_discount_"+json.discounts[i].id_cart_rule+"'> \ 48 <td class='cart_discount_name' colspan='3'>"+json.discounts[i].name+"</td> \ 49 <td class='cart_discount_price'><span class='price-discount'>"+discountedPrice+"</span></td> \ 50 <td class='cart_discount_delete'>1</td> \ 51 <td class='cart_discount_price'><span class='price-discount price'>"+discountedPrice+"</span></td> \ 52 <td class='price_discount_del'></td> \ 53 </tr> \ 54 </tbody>"; 55 56 $('#cart_summary').append(discountTd); 57 } else if ($('#opc-cart_summary').length) { 58 //Advanced checkout module 59 var discountTd = " \ 60 <tbody> \ 61 <tr class='cart_discount' id='cart_discount_"+json.discounts[i].id_cart_rule+"'> \ 62 <td class='cart_discount_name cart_description' colspan='3'>"+json.discounts[i].name+"</td> \ 63 <td class='cart_unit'> \ 64 <!-- <div class='mobile_table_title visible-phone'>Unit price b</div> \ 65 <div class='mobile_table_content'> \ 66 <span class='price-discount price'> \ 67 "+discountedPrice+" \ 68 </span> \ 69 </div> --> \ 70 </td> \ 71 <td></td> \ 72 <td class='cart_discount_delete'> \ 73 <!-- <div class='mobile_table_title visible-phone'>Qty</div> \ 74 <div class='mobile_table_content'>1</div> --> \ 75 </td> \ 76 <td class='cart_total'> \ 77 <div class='mobile_table_title visible-phone'>Total</div> \ 78 <div class='mobile_table_content'> \
79 <span class='price-discount price'> \ 80 "+discountedPrice+" \ 81 </span> \ 82 </div> \ 83 </td> \ 84 <td class='price_discount_del'> \ 85 <div class='mobile_table_title visible-phone'></div> \ 86 <div class='mobile_table_content'> \ 87 "+ (json.discounts[i].code ? "<a onclick='deldisc("+json.discounts[i].id_cart_rule+")' class='price_discount_delete'><i class='fa-trash fa'></i></a>" : "") +" \ 88 </div> \ 89 </td> \ 90 </tr> \ 91 </tbody>"; 92 93 $('#opc-cart_summary').append(discountTd); 94 95 } 96 } 97 } 98 } 99 100 if (json && $.isEmptyObject(json.gift_products)) { 101 $('#cart_summary [id ^=product_][id $=gift]').remove(); 102 } 103 }; 104 })(); 105} 106 107if (typeof prestashop === 'object') { 108 $('body.page-cart .btn-touchspin').on('click', function() { 109 $('.btn-touchspin').attr('disabled', 'disabled') 110 }); 111 112 prestashop.on('updatedProduct', function () { 113 $('.btn-touchspin').removeAttr("disabled"); 114 }); 115} 116 117if (typeof upQuantity === "function") { 118 function upQuantity(id, qty) 119 { 120 $('.cart_quantity_up').off('click').on('click', function(e){ 121 e.preventDefault(); 122 }); 123 124 if (typeof(qty) == 'undefined' || !qty) 125 qty = 1; 126 var customizationId = 0; 127 var productId = 0; 128 var productAttributeId = 0; 129 var id_address_delivery = 0; 130 var ids = 0; 131 ids = id.split('_'); 132 productId = parseInt(ids[0]); 133 if (typeof(ids[1]) !== 'undefined') 134 productAttributeId = parseInt(ids[1]); 135 if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') 136 customizationId = parseInt(ids[2]); 137 if (typeof(ids[3]) !== 'undefined') 138 id_address_delivery = parseInt(ids[3]); 139 140 $.ajax({ 141 type: 'POST', 142 headers: { "cache-control": "no-cache" }, 143 url: baseUri + '?rand=' + new Date().getTime(), 144 async: true, 145 cache: false, 146 dataType: 'json', 147 data: 'controller=cart' 148 + '&ajax=true' 149 + '&add=true' 150 + '&getproductprice=true' 151 + '&summary=true' 152 + '&id_product=' + productId 153 + '&ipa=' + productAttributeId 154 + '&id_address_delivery=' + id_address_delivery 155 + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') 156 + '&qty=' + qty 157 + '&token=' + static_token 158 + '&allow_refresh=1', 159 success: function(jsonData) 160 { 161 if (jsonData.hasError) 162 { 163 var errors = ''; 164 for(var error in jsonData.errors) 165 //IE6 bug fix 166 if(error !== 'indexOf') 167 errors += $('<div />').html(jsonData.errors[error]).text() + "\n"; 168 if (!!$.prototype.fancybox) 169 $.fancybox.open([ 170 { 171 type: 'inline', 172 autoScale: true, 173 minHeight: 30, 174 content: '<p class="fancybox-error">' + errors + '</p>' 175 }], 176 { 177 padding: 0 178 }); 179 else 180 alert(errors); 181 $('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val()); 182 } 183 else 184 { 185 if (jsonData.refresh) 186 window.location.href = window.location.href; 187 updateCartSummary(jsonData.summary); 188 if (window.ajaxCart != undefined) 189 ajaxCart.updateCart(jsonData); 190 if (customizationId !== 0) 191 updateCustomizedDatas(jsonData.customizedDatas); 192 updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); 193 updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); 194 if (typeof(getCarrierListAndUpdate) !== 'undefined') 195 getCarrierListAndUpdate(); 196 if (typeof(updatePaymentMethodsDisplay) !== 'undefined') 197 updatePaymentMethodsDisplay(); 198 } 199 }, 200 error: function(XMLHttpRequest, textStatus, errorThrown) { 201 if (textStatus !== 'abort') 202 { 203 error = "TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus; 204 if (!!$.prototype.fancybox) 205 $.fancybox.open([ 206 { 207 type: 'inline', 208 autoScale: true, 209 minHeight: 30, 210 content: '<p class="fancybox-error">' + error + '</p>' 211 }], 212 { 213 padding: 0 214 }); 215 else 216 alert(error); 217 } 218 } 219 220 }).done(function() { 221 $('.cart_quantity_up').off('click').on('click', function(e){ 222 e.preventDefault(); 223 upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); 224 $('#' + $(this).attr('id').replace('_up_', '_down_')).removeClass('disabled'); 225 }); 226 }).fail(function() { 227 $('.cart_quantity_up').off('click').on('click', function(e){ 228 e.preventDefault(); 229 upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); 230 $('#' + $(this).attr('id').replace('_up_', '_down_')).removeClass('disabled'); 231 }); 232 }); 233 } 234}; 235 236if (typeof downQuantity === "function") { 237 function downQuantity(id, qty) 238 { 239 $('.cart_quantity_down').off('click').on('click', function(e){ 240 e.preventDefault(); 241 }); 242 243 var val = $('input[name=quantity_' + id + ']').val(); 244 var newVal = val; 245 if(typeof(qty) == 'undefined' || !qty) 246 { 247 qty = 1; 248 newVal = val - 1; 249 } 250 else if (qty < 0) 251 qty = -qty; 252 253 var customizationId = 0; 254 var productId = 0; 255 var productAttributeId = 0; 256 var id_address_delivery = 0; 257 var ids = 0; 258 259 ids = id.split('_'); 260 productId = parseInt(ids[0]); 261 if (typeof(ids[1]) !== 'undefined') 262 productAttributeId = parseInt(ids[1]); 263 if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') 264 customizationId = parseInt(ids[2]); 265 if (typeof(ids[3]) !== 'undefined') 266 id_address_delivery = parseInt(ids[3]); 267 268 if (newVal > 0 || $('#product_' + id + '_gift').length) 269 { 270 $.ajax({ 271 type: 'POST', 272 headers: { "cache-control": "no-cache" }, 273 url: baseUri + '?rand=' + new Date().getTime(), 274 async: true, 275 cache: false, 276 dataType: 'json', 277 data: 'controller=cart' 278 + '&ajax=true' 279 + '&add=true' 280 + '&getproductprice=true' 281 + '&summary=true' 282 + '&id_product='+productId 283 + '&ipa='+productAttributeId 284 + '&id_address_delivery='+id_address_delivery 285 + '&op=down' 286 + ((customizationId !== 0) ? '&id_customization='+customizationId : '') 287 + '&qty='+qty 288 + '&token='+static_token 289 + '&allow_refresh=1', 290 success: function(jsonData) 291 { 292 if (jsonData.hasError) 293 { 294 var errors = ''; 295 for(var error in jsonData.errors) 296 //IE6 bug fix 297 if(error !== 'indexOf') 298 errors += $('<div />').html(jsonData.errors[error]).text() + "\n"; 299 if (!!$.prototype.fancybox) 300 $.fancybox.open([ 301 { 302 type: 'inline', 303 autoScale: true, 304 minHeight: 30, 305 content: '<p class="fancybox-error">' + errors + '</p>' 306 }], 307 { 308 padding: 0 309 }); 310 else 311 alert(errors); 312 $('input[name=quantity_' + id + ']').val($('input[name=quantity_' + id + '_hidden]').val()); 313 } 314 else 315 { 316 if (jsonData.refresh) 317 window.location.href = window.location.href; 318 updateCartSummary(jsonData.summary); 319 320 if (window.ajaxCart !== undefined) 321 ajaxCart.updateCart(jsonData); 322 if (customizationId !== 0) 323 updateCustomizedDatas(jsonData.customizedDatas); 324 updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); 325 updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); 326 327 if (newVal == 0) 328 $('#product_' + id).hide(); 329 330 if (typeof(getCarrierListAndUpdate) !== 'undefined') 331 getCarrierListAndUpdate(); 332 if (typeof(updatePaymentMethodsDisplay) !== 'undefined') 333 updatePaymentMethodsDisplay(); 334 } 335 }, 336 error: function(XMLHttpRequest, textStatus, errorThrown) { 337 if (textStatus !== 'abort') 338 alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); 339 } 340 }).done(function() { 341 $('.cart_quantity_down').off('click').on('click', function(e){ 342 e.preventDefault(); 343 downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); 344 }); 345 }).fail(function() { 346 $('.cart_quantity_down').off('click').on('click', function(e){ 347 e.preventDefault(); 348 downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); 349 }); 350 }); 351 352 } 353 else 354 { 355 deleteProductFromSummary(id); 356 357 $('.cart_quantity_down').off('click').on('click', function(e){ 358 e.preventDefault(); 359 downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); 360 }); 361 } 362 } 363};
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.