1if(typeof Virtuemart === "undefined") 2 { 3 var Virtuemart = { 4 setproducttype : function (form, id) { 5 form.view = null; 6 var $ = jQuery, datas = form.serialize(); 7 var prices = form.parent(".productdetails").find(".product-price"); 8 if (0 == prices.length) { 9 prices = $("#productPrice" + id); 10 } 11 datas = datas.replace("&view=cart", ""); 12 prices.fadeTo("fast", 0.75); 13 $.getJSON(window.vmSiteurl + 'index.php?option=com_virtuemart&nosef=1&view=productdetails&task=recalculate&virtuemart_product_id='+id+'&format=json' + window.vmLang, encodeURIComponent(datas), 14 function (datas, textStatus) { 15 prices.fadeTo("fast", 1); 16 // refresh price 17 for (var key in datas) { 18 var value = datas[key]; 19 if (value!=0) prices.find("span.Price"+key).show().html(value); 20 else prices.find(".Price"+key).html(0).hide(); 21 } 22 }); 23 return false; // prevent reload 24 }, 25 productUpdate : function(mod) { 26 27 var $ = jQuery ; 28 $.ajaxSetup({ cache: false }) 29 $.getJSON(window.vmSiteurl+"index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json"+window.vmLang, 30 function(datas, textStatus) { 31 if (datas.totalProduct >0) { 32 mod.find(".vm_cart_products").html(""); 33 $.each(datas.products, function(key, val) { 34 $("#hiddencontainer .container").clone().appendTo(".vmCartModule .vm_cart_products"); 35 $.each(val, function(key, val) { 36 if ($("#hiddencontainer .container ."+key)) mod.find(".vm_cart_products ."+key+":last").html(val) ; 37 }); 38 }); 39 mod.find(".total").html(datas.billTotal); 40 mod.find(".show_cart").html(datas.cart_show); 41 } 42 mod.find(".total_products").html(datas.totalProductTxt); 43 } 44 ); 45 }, 46 sendtocart : function (form){ 47 48 if (Virtuemart.addtocart_popup ==1) { 49 Virtuemart.cartEffect(form) ; 50 } else { 51 form.append('<input type="hidden" name="task" value="add" />'); 52 form.submit(); 53 } 54 }, 55 cartEffect : function(form) { 56 57 var $ = jQuery ; 58 $.ajaxSetup({ cache: false }); 59 var datas = form.serialize(); 60 61 if(usefancy){ 62 $.fancybox.showActivity(); 63 } 64 65 $.getJSON(vmSiteurl+'index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json'+vmLang,datas, 66 function(datas, textStatus) { 67 if(datas.stat ==1){ 68 69 var txt = datas.msg; 70 } else if(datas.stat ==2){ 71 var txt = datas.msg +"<H4>"+form.find(".pname").val()+"</H4>"; 72 } else { 73 var txt = "<H4>"+vmCartError+"</H4>"+datas.msg; 74 } 75 if(usefancy){ 76 $.fancybox({ 77 "titlePosition" : "inside", 78 "transitionIn" : "fade", 79 "transitionOut" : "fade", 80 "changeFade" : "fast", 81 "type" : "html", 82 "autoCenter" : true, 83 "closeBtn" : false, 84 "closeClick" : false, 85 "content" : txt 86 } 87 ); 88 } else { 89 $.facebox.settings.closeImage = closeImage; 90 $.facebox.settings.loadingImage = loadingImage; 91 //$.facebox.settings.faceboxHtml = faceboxHtml; 92 $.facebox({ text: txt }, 'my-groovy-style'); 93 } 94 95 if ($(".vmCartModule")[0]) { 96 Virtuemart.productUpdate($(".vmCartModule")); 97 } 98 }); 99 100 $.ajaxSetup({ cache: true }); 101 }, 102 product : function(carts) { 103 carts.each(function(){ 104 var cart = jQuery(this), 105 step=cart.find('input[name="quantity"]'), 106 addtocart = cart.find('input.addtocart-button'), 107 plus = cart.find('.quantity-plus'), 108 minus = cart.find('.quantity-minus'), 109 select = cart.find('select:not(.no-vm-bind)'),
110 radio = cart.find('input:radio:not(.no-vm-bind)'), 111 virtuemart_product_id = cart.find('input[name="virtuemart_product_id[]"]').val(), 112 quantity = cart.find('.quantity-input'); 113 114 var Ste = parseInt(step.val()); 115 //Fallback for layouts lower than 2.0.18b 116 if(isNaN(Ste)){ 117 Ste = 1; 118 } 119 addtocart.click(function(e) { 120 Virtuemart.sendtocart(cart); 121 return false; 122 }); 123 plus.click(function() { 124 var Qtt = parseInt(quantity.val()); 125 if (!isNaN(Qtt)) { 126 quantity.val(Qtt + Ste); 127 Virtuemart.setproducttype(cart,virtuemart_product_id); 128 } 129 130 }); 131 minus.click(function() { 132 var Qtt = parseInt(quantity.val()); 133 if (!isNaN(Qtt) && Qtt>Ste) { 134 quantity.val(Qtt - Ste); 135 } else quantity.val(Ste); 136 Virtuemart.setproducttype(cart,virtuemart_product_id); 137 }); 138 select.change(function() { 139 Virtuemart.setproducttype(cart,virtuemart_product_id); 140 }); 141 radio.change(function() { 142 Virtuemart.setproducttype(cart,virtuemart_product_id); 143 }); 144 quantity.keyup(function() { 145 Virtuemart.setproducttype(cart,virtuemart_product_id); 146 }); 147 }); 148 149 } 150 }; 151 jQuery.noConflict(); 152 jQuery(document).ready(function($) { 153 154 Virtuemart.product($("form.product")); 155 156 $("form.js-recalculate").each(function(){ 157 if ($(this).find(".product-fields").length && !$(this).find(".no-vm-bind").length) { 158 var id= $(this).find('input[name="virtuemart_product_id[]"]').val(); 159 Virtuemart.setproducttype($(this),id); 160 161 } 162 }); 163 }); 164 }
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.