1(function ($) { 2extend('ActiveCommerce.Product.Cart', { 3 config: { 4 headerCountId: 'header-cart-count', 5 modalId: 'added-to-cart', 6 containerClass: 'added-product', 7 templateId: 'cart-product', 8 closeClass: 'close', 9 continueClass: 'continue-shopping', 10 viewClass: 'view-cart' 11 }, 12 13 $elements: { 14 modal: null, 15 addedProductContainer : null 16 }, 17 18 init: function () { 19 var o = ActiveCommerce.Product.Cart, 20 c = $.extend(true, o.config, o.serverConfig), 21 $e = o.$elements; 22 23 $e.modal = $('#' + c.modalId); 24 $e.addedProductContainer = $e.modal.find('.' + c.containerClass); 25 26 if (ActiveCommerce.Product.Analytics) { 27 // Hook up analytics 28 $e.modal 29 .on('click', '.' + c.closeClass, ActiveCommerce.Product.Analytics.addedCloseClick) 30 .on('click', '.' + c.continueClass, ActiveCommerce.Product.Analytics.addedContinueShoppingClick) 31 .on('click', '.' + c.viewClass, ActiveCommerce.Product.Analytics.addedViewCartClick); 32 } 33 }, 34 35 addProduct: function (addToCartUrl, completeCallback) { 36 var o = ActiveCommerce.Product.Cart; 37 38 o.hideModal(); 39 40 $.ajax({
41 url: addToCartUrl, 42 dataType: 'json', 43 cache: false, 44 success: o.onAdded, 45 complete: completeCallback || $.noop 46 }); 47 }, 48 49 onAdded: function (data, textStatus, jqXHR) { 50 var o = ActiveCommerce.Product.Cart, 51 c = o.config, 52 $e = o.$elements; 53 54 // set currentProduct to json feed 55 var currentProduct = data; 56 57 //update header 58 $('#' + c.headerCountId).text(currentProduct.TotalCount); 59 60 // replace popup info with current product 61 $e.addedProductContainer.empty().append($.tmpl(c.templateId, currentProduct)); 62 63 //show added-to-cart popup 64 $e.modal.fadeIn("fast", function () { 65 // enable close button 66 $(this).find('.' + c.closeClass + ', .' + c.continueClass).click(function (e) { 67 e.preventDefault(e); 68 o.hideModal(); 69 }); 70 }); 71 }, 72 73 hideModal: function () { 74 var o = ActiveCommerce.Product.Cart, 75 $e = o.$elements; 76 77 $e.modal.fadeOut("fast"); 78 } 79}); 80 81$(function() { 82 ActiveCommerce.Product.Cart.init(); 83}); 84 85})(jQuery); 86 87function UpdateCartLineExtended(backordercount) { 88 var o = ActiveCommerce.Product.Cart; 89 var code = $("#productcode").val(); 90 var backorder = "0"; 91 $.ajax({
92 url: "/ac/cart/UpdateCartLineExtended", 93 data: { code: code, quantity: backordercount, quantityBackorder: backorder }, 94 dataType: 'json', 95 method: "post", 96 cache: false, 97 success: function (data) { 98 $("#header-cart-count").text(data.TotalCount); 99 } 100 }); 101 o.hideModal(); 102 $("#txt-add-to-cart-quantity").val(1); 103} 104 105 106function RemoveProductFromCart() { 107 var o = ActiveCommerce.Product.Cart; 108 var code = $("#productcode").val(); 109 $.ajax({ 110 url: "/ac/cart/RemoveFromCartExtended", 111 data: { code: code }, 112 dataType: 'json', 113 method: "post", 114 cache: false, 115 success: function (data) { 116 $("#header-cart-count").text(data.TotalCount); 117 } 118 }); 119 o.hideModal(); 120 $("#txt-add-to-cart-quantity").val(1); 121}
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.