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 19jQuery.fn.tooltip = window._BStooltip; 20 21$(document).ready(function () { 22 prestashop.blockcart = prestashop.blockcart || {}; 23 24 var showModal = prestashop.blockcart.showModal || function (modal) {}; 25 26 $(document).ready(function () { 27 28 $(document).on('click', '#js-cart-close', function (e) { 29 $('#blockcart, #mobile-cart-wrapper, #_mobile_blockcart-content, #_desktop_blockcart-content').removeClass('show'); 30 e.stopPropagation(); 31 }); 32 33 $(document).on('click', '#blockcart-content', function (e) { 34 e.stopPropagation(); 35 }); 36 37 38 prestashop.on( 39 'updateCart', 40 function (event) { 41 var refreshURL = $('#blockcart').data('refresh-url'); 42 var requestData = {}; 43 44 if (event && event.reason && typeof event.resp !== 'undefined' && !event.resp.hasError) { 45 46 requestData = { 47 id_customization: event.reason.idCustomization, 48 id_product_attribute: event.reason.idProductAttribute, 49 id_product: event.reason.idProduct, 50 action: event.reason.linkAction 51 }; 52 53 } 54 $.post(refreshURL, requestData).then(function (resp) { 55 56 if (event.reason && event.reason.linkPlace == 'cart-preview') { 57 $('#blockcart').replaceWith($(resp.preview).addClass('show')); 58 } else { 59 $('#blockcart').replaceWith($(resp.preview)); 60 } 61 62 $('#mobile-cart-products-count').text($(resp.preview).find('.cart-products-count-btn').first().text()); 63 64 prestashop.emit('responsive updateAjax', { 65 mobile: prestashop.responsive.mobile 66 }); 67 68 prestashop.emit('updatedAjaxCart', {}); 69 prestashop.emit('updateFacets',window.location.href); 70 71 if (resp.modal) { 72 showModal(resp.modal); 73 } 74 }).fail(function (resp) { 75 prestashop.emit('handleError', {eventType: 'updateShoppingCart', resp: resp}); 76 }); 77 78 if (event && event.resp && event.resp.hasError) { 79 prestashop.emit('showErrorNextToAddtoCartButton', { errorMessage: event.resp.errors.join('<br/>')}); 80 } 81 } 82 ); 83 }); 84});
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.