Rev 1463 | Rev 3830 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
var totalAmount = 0.00;$(document).ready(function(){changeEstimate();$('#cartTable td img.remove-quantitybttn').click(function(){var prodID = $(this).parent().parent().parent().children().find("span.pro").attr("id");window.location.href = "/cart/" + prodID + "?_method=delete" + "&productid=" + prodID;});$('#applyCoupon').click(function(){$('#couponAction').val('applycoupon');$('#frmCouponCode').submit();});$('#removeCoupon').click(function(){$('#couponAction').val('removecoupon');$('#frmCouponCode').submit();});});function changeQty(obj,itempriceID,totalPriceID) {var prodID = $(obj).parent().parent().parent().parent().parent().parent().children().find("span.pro").attr("id");var quantity = parseInt(obj.value);if (quantity > 5) {alert("You can not order more than 5 pieces of same product.");$(obj).focus();}else {jQuery.ajax({type: "POST",url: "/cart/" + prodID + "?_method=put&productid=" + prodID + "&quantity=" + quantity,data: "productid=" + prodID + "&quantity=" + quantity,success: function(msg){window.location.reload();}});}}function sumOfColumns(tableID, columnIndex, hasHeader) {var tot = 0;var inc = 1;var tableElement = $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""));var tableChildren = tableElement.children("td:nth-child(" + columnIndex + ")");tableChildren.each(function() {var currentVal = document.getElementById('totalPrice' + inc).innerHTML;inc ++;var splitVal = currentVal.split("Rs.");var num = parseFloat(splitVal[1].replace(/[^\d\.-]/g,''));tot += parseFloat(num);});totalAmount = tot;var formated_value = $().number_format(tot, {numberOfDecimals:2,decimalSeparator: '.',thousandSeparator: ',',symbol: 'Rs.'});return formated_value;}function subtractionOfColumns(tableID, columnIndex, hasHeader) {var tot = 0;$("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : "")).children("td:nth-child(" + columnIndex + ")").each(function(){var currentVal=$(this).html();var splitVal=currentVal.split("Rs.");var num = parseFloat(splitVal[1].replace(/[^\d\.-]/g,''));tot += parseInt(num);});var formated_value = $().number_format(tot, {numberOfDecimals: 2,decimalSeparator: '.',thousandSeparator: ',',symbol: 'Rs.'});return formated_value;}function changeEstimate(item_id) {if(item_id == null ) {for(var i = 0; ; i ++) {var obj = $("#itemID" + (i + 1));var itemId = $(obj).parent().parent().find("span.pro").attr("id");if(itemId == null) {break;}changeEstimate(itemId);}} else {jQuery.ajax({type: "GET",url: "/estimate/" + $("#zipcode").val() + "_" + item_id,beforeSend: function(){$("#days" + "_" + item_id).html("<img src='/images/loader_l.gif'>");},success: function(msg){$("#shipping_time" + "_" + item_id).html(msg);}});}}