1/* global $, prestashop */ 2 3/** 4 * This module exposes an extension point in the form of the `showModal` function. 5 * 6 * If you want to override the way the modal window is displayed, simply define: 7 * 8 * prestashop.blockcart = prestashop.blockcart || {}; 9 * prestashop.blockcart.showModal = function myOwnShowModal (modalHTML) { 10 * // your own code 11 * // please not that it is your responsibility to handle closing the modal too 12 * }; 13 * 14 * Attention: your "override" JS needs to be included **before** this file. 15 * The safest way to do so is to place your "override" inside the theme's main JS file. 16 * 17 */ 18 19$(document).ready(function () { 20 prestashop.blockcart = prestashop.blockcart || {}; 21 22 var showModal = prestashop.blockcart.showModal || function (modal) { 23 var $body = $('body'); 24 $body.append(modal); 25 $body.one('click', '#blockcart-modal', function (event) { 26 if (event.target.id === 'blockcart-modal') { 27 $(event.target).remove(); 28 } 29 }); 30 }; 31 32 prestashop.on( 33 'updateCart', 34 function (event) { 35 var refreshURL = $('.blockcart').data('refresh-url'); 36 var requestData = {}; 37 if (event && event.reason && typeof event.resp !== 'undefined' && !event.resp.hasError) { 38 requestData = { 39 id_customization: event.reason.idCustomization, 40 id_product_attribute: event.reason.idProductAttribute, 41 id_product: event.reason.idProduct, 42 action: event.reason.linkAction 43 }; 44 45 $.post(refreshURL, requestData).then(function (resp) { 46 $data = $(resp.preview); 47 $('.blockcart').replaceWith($($data).find('.blockcart')[0]); 48 //$('.mobile-cart').replaceWith($($data).find('.mobile-cart')); 49 if (resp.modal) { 50 showModal(resp.modal); 51 } 52 53 $('.form-group.product-variants-item input.input-color.d-none').each(function (index, value){ 54 if ($(this).is(':checked')) { 55var ererr = '.favorites-module-block.pid-' + $('input.favorite_id_product').attr( "value" ) + '-1-' + $(this).attr( "value" ); 56 $(ererr).show(); 57 58} 59}); 60 61 }).fail(function (resp) { 62 prestashop.emit('handleError', { eventType: 'updateShoppingCart', resp: resp }); 63 }); 64 } 65 if (event && event.resp && event.resp.hasError) { 66 prestashop.emit('showErrorNextToAddtoCartButton', { errorMessage: event.resp.errors.join('<br/>')}); 67 } 68 } 69 ); 70});
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.