Subversion Repositories SmartDukaan

Rev

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

Rev 2759 Rev 2762
Line 22... Line 22...
22
		_gaq.push(['_trackPageview', page]);
22
		_gaq.push(['_trackPageview', page]);
23
	}
23
	}
24
}
24
}
25
	
25
	
26
$(function() {
26
$(function() {
-
 
27
	  $('.add-to-cart-icon').live('click', function() {
-
 
28
	    var items = this.id;
-
 
29
	    var itemsarray = items.split('-');
-
 
30
	    var catalogid = $(this).attr('catalogid');
-
 
31
	    addToCart(itemsarray[1], itemsarray[0], catalogid);
-
 
32
	    return false;
-
 
33
	  });
-
 
34
	  
27
	$("a.addtocart").live('click', function() {
35
	$("a.addtocart").live('click', function() {
28
		var catalogid = $(this).attr('catalogid');
36
		var catalogid = $(this).attr('catalogid');
29
 
37
 
30
		var radBtn = "";
38
		var radBtn = "";
31
		var param = "PARAMETERS_" + catalogid;
39
		var param = "PARAMETERS_" + catalogid;
32
	
-
 
-
 
40
		radBtn += '<input type="hidden" id="selected_catalog_id" value=' + catalogid + ' />';
33
		$.each(eval(param), function(val, text) {
41
		$.each(eval(param), function(val, text) {
34
			radBtn += '<label><input type="radio" name="radColorSel" value="' + val + '" /> <span>' + text + '</span></label>';
42
			radBtn += '<label><input type="radio" name="radColorSel" value="' + val + '" /> <span>' + text + '</span></label>';
35
		});
43
		});
36
		
44
		
37
		radBtn += '<div class="clearBoth"></div>';
45
		radBtn += '<div class="clearBoth"></div>';
Line 48... Line 56...
48
	
56
	
49
});
57
});
50
 
58
 
51
 
59
 
52
 
60
 
53
function addToCart(refdivid,reqtype){
61
function addToCart(refdivid,reqtype, catalogid){
54
     var seldata="";
62
     var seldata="";
55
     var tot=0;
63
     var tot=0;
56
     var saprt="";
64
     var saprt="";
57
     if(reqtype == "multi"){
65
     if(reqtype == "multi"){
58
          var containerdiv = "#" + refdivid;
66
          var containerdiv = "#" + refdivid;
Line 95... Line 103...
95
    		 data: "productid=" + seldata,
103
    		 data: "productid=" + seldata,
96
    		 success: function(msg){
104
    		 success: function(msg){
97
    			 if(msg==""){
105
    			 if(msg==""){
98
    				 window.location = "/cart";
106
    				 window.location = "/cart";
99
    			 }else{
107
    			 }else{
100
    				 displayRelatedProducts(msg);
108
    				 displayRelatedProducts(msg, catalogid);
101
    			 }
109
    			 }
102
    		 }
110
    		 }
103
    	 });
111
    	 });
104
     } else	{
112
     } else	{
105
    	 alert("Please select atleast one product");
113
    	 alert("Please select atleast one product");
Line 108... Line 116...
108
 
116
 
109
 
117
 
110
function selectColor(){
118
function selectColor(){
111
	var selected = $(".colorSelLightBoxColor .content input[name='radColorSel']:checked");
119
	var selected = $(".colorSelLightBoxColor .content input[name='radColorSel']:checked");
112
	var itemid = selected.val();
120
	var itemid = selected.val();
113
 
121
	
-
 
122
	var catalogid = $(".colorSelLightBoxColor .content #selected_catalog_id").val();
114
	trackEventWithGA('Order', 'Select Product Color', itemid);
123
	trackEventWithGA('Order', 'Select Product Color', itemid);
115
	
124
	
116
	if(itemid == undefined)	{
125
	if(itemid == undefined)	{
117
		alert('Please select a color.');
126
		alert('Please select a color.');
118
	} else	{
127
	} else	{
119
		addToCart(itemid,'list');
128
		addToCart(itemid,'list', catalogid);
120
	}
129
	}
121
}
130
}
122
 
131
 
123
 
132
 
124
function displayRelatedProducts(message){
133
function displayRelatedProducts(message, catalogId){
125
	var radBtn = "<div id='cartRecommendationBox'>";
134
	var radBtn = "<div id='cartRecommendationBox'>";
126
	jQuery.ajax({
135
	jQuery.ajax({
127
		type: "GET",
136
		type: "GET",
128
		url: "/related-products/" + $("#product_id").val(),
137
		url: "/related-products/" + catalogId,
129
		data: "productid=" + $("#product_id").val(),
-
 
130
		success: function(msg)	{
138
		success: function(msg)	{
131
			radBtn += "<h3 style='margin-top:5px; margin-bottom:5px;'>" + message + "</h3>";
139
			radBtn += "<h3 style='margin-top:5px; margin-bottom:5px;'>" + message + "</h3>";
132
			if($.trim(msg)!=""){
140
			if($.trim(msg)!=""){
133
				radBtn += "<span style='font-size:14px; color:#003300; background-color:#ffffdd;  margin-bottom:8px;'>You can check out following similar products</span><hr size=1/>";
141
				radBtn += "<span style='font-size:14px; color:#003300; background-color:#ffffdd;  margin-bottom:8px;'>You can check out following similar products</span><hr size=1/>";
134
			}
142
			}