1/** 2 * 2010-2017 Webkul. 3 * 4 * NOTICE OF LICENSE 5 * 6 * All right is reserved, 7 * Please go through this link for complete license : https://store.webkul.com/license.html 8 * 9 * DISCLAIMER 10 * 11 * Do not edit or add to this file if you wish to upgrade this module to newer 12 * versions in the future. If you wish to customize this module for your 13 * needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. 14 * 15 * @author Webkul IN <[email protected]> 16 * @copyright 2010-2017 Webkul IN 17 * @license https://store.webkul.com/license.html 18 */ 19 20$(document).ready(function() { 21 //click add to cart from product page 22 if (typeof allGiftTypes != 'undefined') { 23 $(document).on('click', '#add_to_cart button', function(e) { 24 e.preventDefault(); 25 var giftSelected = []; 26 var idPsBundleProduct = $('#product_page_product_id').val(); 27 28 $.each(jQuery.parseJSON(allGiftTypes), function(gifttypeid, gifttype) { 29 var selectedProductId = $('input[name="bundle_gift_product_' + gifttypeid + '"]:checked').val(); 30 giftSelected.push(gifttypeid + '-' + selectedProductId); 31 }); 32 33 if (giftSelected) { 34 $callBlockAjax = true; 35 if (typeof idCartContext != 'undefined') { 36 $callBlockAjax = false; 37 } 38 39 if ($callBlockAjax == true) { 40 //if cart id not exist till now in context 41 $(document).ajaxComplete(function(event, xhr, settings) { 42 if (settings.url != ajaxUrlbundlegiftorderprocess) { //don't call ajax if previous ajax run on my module 43 callGiftProductForBundle(idPsBundleProduct, giftSelected); 44 } 45 }); 46 } else { 47 //if cart id exist in context 48 callGiftProductForBundle(idPsBundleProduct, giftSelected); 49 } 50 } 51 }); 52 } else { 53 //click add to cart from category page 54 $(document).on('click', '.ajax_add_to_cart_button', function(e) { 55 56 var idPsBundleProduct = $(this).data('id-product'); 57 if (idPsBundleProduct) { 58 $callBlockAjax = true; 59 if (typeof idCartContext != 'undefined') { 60 $callBlockAjax = false; 61 } 62 63 if ($callBlockAjax == true) { 64 //if cart id not exist till now in context 65 $(document).ajaxComplete(function(event, xhr, settings) { 66 if (settings.url != ajaxUrlbundlegiftorderprocess) { //don't call ajax if previous ajax run on my module 67 callGiftProductForBundleOnCategory(idPsBundleProduct); 68 } 69 }); 70 } else { 71 //if cart id exist in context 72 callGiftProductForBundleOnCategory(idPsBundleProduct); 73 } 74 } 75 }); 76 } 77}); 78 79function callGiftProductForBundle(idPsBundleProduct, giftSelected) { 80 $.ajax({ 81 url: ajaxUrlbundlegiftorderprocess, 82 type: 'POST', 83 async: false, 84 data: { 85 ajax: "1", 86 action: "getGiftProductForBundle", 87 idPsBundleProduct: idPsBundleProduct, 88 giftSelected: giftSelected 89 }, 90 success: function(result) { 91 $('#layer_cart_bundle_product_gift').html(result + '<br>'); 92 } 93 }); 94} 95 96function callGiftProductForBundleOnCategory(idPsBundleProduct) { 97 $.ajax({ 98 url: ajaxUrlbundlegiftorderprocess, 99 type: 'POST', 100 async: false, 101 data: { 102 ajax: "1", 103 action: "getGiftProductForBundleOnCategory", 104 idPsBundleProduct: idPsBundleProduct 105 }, 106 success: function(result) { 107 $('#layer_cart_bundle_product_gift').html(result + '<br>'); 108 } 109 }); 110}
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.