Subversion Repositories SmartDukaan

Rev

Rev 1048 | Rev 1460 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1048 Rev 1190
Line 34... Line 34...
34
    var totalAmount=subtractionOfColumns("cartTable", 5, true);
34
    var totalAmount=subtractionOfColumns("cartTable", 5, true);
35
    $("#totalAmount").html(totalAmount);
35
    $("#totalAmount").html(totalAmount);
36
    */
36
    */
37
  });
37
  });
38
}); 
38
}); 
39
 
39
 
40
function changeQty(obj,itempriceID,totalPriceID) {
40
function changeQty(obj,itempriceID,totalPriceID)	{
41
  var prodID = $(obj).parent().parent().parent().parent().parent().parent().children().find("span.pro").attr("id");
41
	var prodID = $(obj).parent().parent().parent().parent().parent().parent().children().find("span.pro").attr("id");
42
  var quantity = parseInt(obj.value);
42
	var quantity = parseInt(obj.value);
43
  //alert("AJAX request to change product quantity in Cart. Product ID: " + prodID + " quantity: " + quantity);
43
	//alert("AJAX request to change product quantity in Cart. Product ID: " + prodID + " quantity: " + quantity);
44
		
44
 
45
  jQuery.ajax({
45
	jQuery.ajax({
46
    type: "POST",
46
		type: "POST",
47
    url: "/cart/" + prodID + "?_method=put&productid="+prodID+ "&quantity="+quantity,
47
		url: "/cart/" + prodID + "?_method=put&productid=" + prodID + "&quantity=" + quantity,
48
    data: "productid="+prodID+ "&quantity="+quantity,
48
		data: "productid=" + prodID + "&quantity=" + quantity,
49
    success: function(msg){
49
		success: function(msg){
50
      //  alert( "Data Saved: " + msg );
-
 
51
      if(msg==1){
50
/*			if(msg == 1)	{
52
      //   	alert( "Quantity Updates for the item" );
51
				//   	alert( "Quantity Updates for the item" );
53
      }else{
52
			} else	{
54
        // 	alert( "Not able to update the quantity for the item" );
53
				// 	alert( "Not able to update the quantity for the item" );
55
        return;
54
				return;
56
      }
55
			}*/
57
      window.location.reload();
56
			window.location.reload();
58
    }
57
		}
59
  });
58
	});
60
		
59
 
61
  var val=document.getElementById(itempriceID).value;
60
//	var val=document.getElementById(itempriceID).value;
62
  var num = parseFloat(val.replace(/[^\d\.-]/g,''));
61
//	var num = parseFloat(val.replace(/[^\d\.-]/g,''));
63
  var qty=parseInt(obj.value);
62
//	var qty=parseInt(obj.value);
64
  var totalVal1=num*qty;
63
//	var totalVal1=num*qty;
65
  var formated_value = $().number_format(totalVal1, {
64
//	var formated_value = $().number_format(totalVal1, {
66
    numberOfDecimals:2,
65
//		numberOfDecimals:2,
67
    decimalSeparator: '.',
66
//		decimalSeparator: '.',
68
    thousandSeparator: ',',
67
//		thousandSeparator: ',',
69
    symbol: 'Rs. '
68
//		symbol: 'Rs. '
70
  });
69
//	});
71
  document.getElementById(totalPriceID).innerHTML=formated_value;	
70
//	document.getElementById(totalPriceID).innerHTML=formated_value;
72
  $("#totalAmount").html(sumOfColumns("cartTable", 5, true));
71
//	$("#totalAmount").html(sumOfColumns("cartTable", 5, true));
73
			
-
 
74
  changeEstimate(prodID);
72
//	changeEstimate(prodID);
75
}
73
}
76
 
74
 
77
function sumOfColumns(tableID, columnIndex, hasHeader) {
75
function sumOfColumns(tableID, columnIndex, hasHeader) {
78
  var tot = 0;
76
  var tot = 0;
79
  var inc=1;
77
  var inc=1;