Subversion Repositories SmartDukaan

Rev

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

Rev 1868 Rev 1873
Line 21... Line 21...
21
 
21
 
22
$(function() {
22
$(function() {
23
	$("a.addtocart").live('click', function() {
23
	$("a.addtocart").live('click', function() {
24
		var catalogid = $(this).attr('catalogid');
24
		var catalogid = $(this).attr('catalogid');
25
 
25
 
26
		trackEventWithGA('Order', 'Add to Cart', catalogid);
-
 
27
		
-
 
28
		var radBtn = "";
26
		var radBtn = "";
29
		var param = "PARAMETERS_" + catalogid;
27
		var param = "PARAMETERS_" + catalogid;
30
	
28
	
31
		$.each(eval(param), function(val, text) {
29
		$.each(eval(param), function(val, text) {
32
			radBtn += '<label><input type="radio" name="radColorSel" value="' + val + '" /> <span>' + text + '</span></label>';
30
			radBtn += '<label><input type="radio" name="radColorSel" value="' + val + '" /> <span>' + text + '</span></label>';
Line 118... Line 116...
118
     }else if(reqtype == "list"){
116
     }else if(reqtype == "list"){
119
    	  seldata.unshift(refdivid);
117
    	  seldata.unshift(refdivid);
120
          var tot = 1;
118
          var tot = 1;
121
     }
119
     }
122
 
120
 
123
     trackEventWithGA('Research', 'Add to Research', seldata + "");
-
 
124
     
-
 
125
     if(tot > 0)	{
121
     if(tot > 0)	{
126
          //alert("AJAX request to add products in My research. Product ID: "+seldata+" and total: "+tot);
122
          //alert("AJAX request to add products in My research. Product ID: "+seldata+" and total: "+tot);
127
          jQuery.ajax({
123
          jQuery.ajax({
128
               type: "POST",
124
               type: "POST",
129
                      url: "/addtoresearch",
125
                      url: "/addtoresearch",
Line 141... Line 137...
141
                                $("#pane1").prepend(msg);
137
                                $("#pane1").prepend(msg);
142
                                // $('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
138
                                // $('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
143
                                
139
                                
144
                                if(reqtype == "multi"){
140
                                if(reqtype == "multi"){
145
                                     jQuery.each(seldata,function(intIndex, objValue){
141
                                     jQuery.each(seldata,function(intIndex, objValue){
-
 
142
                                    	 trackEventWithGA('Research', 'Add to Research', objValue);
146
                                    	  add_to_storage_set("resitems", objValue);
143
                                    	  add_to_storage_set("resitems", objValue);
147
                                    	  var tblid="#pane1 #"+objValue+ " td";
144
                                    	  var tblid="#pane1 #"+objValue+ " td";
148
                                          $(tblid + " div a").truncate({addtitle: true});
145
                                          $(tblid + " div a").truncate({addtitle: true});
149
                                          $(tblid + " div div.price").truncate({addtitle: true});
146
                                          $(tblid + " div div.price").truncate({addtitle: true});
150
                                          $(tblid + " div div.text").truncate({addtitle: true});
147
                                          $(tblid + " div div.text").truncate({addtitle: true});
Line 152... Line 149...
152
                                          $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');
149
                                          $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');
153
                                     });
150
                                     });
154
                                     
151
                                     
155
                                }else if(reqtype == "single"){
152
                                }else if(reqtype == "single"){
156
                                	 add_to_storage_set("resitems", seldata);
153
                                	 add_to_storage_set("resitems", seldata);
-
 
154
                                     trackEventWithGA('Research', 'Add to Research', seldata + "");
157
                                     var tblid="#pane1 #"+seldata+ " td";
155
                                     var tblid="#pane1 #"+seldata+ " td";
158
                                     $(tblid + " div a").truncate({addtitle: true});
156
                                     $(tblid + " div a").truncate({addtitle: true});
159
                                     $(tblid + " div div.price").truncate({addtitle: true});
157
                                     $(tblid + " div div.price").truncate({addtitle: true});
160
                                     $(tblid + " div div.text").truncate({addtitle: true});
158
                                     $(tblid + " div div.text").truncate({addtitle: true});
161
                                     $(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');
159
                                     $(tblid).animate({ backgroundColor: "#fcffb3" }, 'slow');
162
                                     $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');  
160
                                     $(tblid).animate({ backgroundColor: "#F5F5F5" }, 'slow');  
163
                                }else if(reqtype == "list"){
161
                                }else if(reqtype == "list"){
-
 
162
 
-
 
163
                                    trackEventWithGA('Research', 'Add to Research', seldata + "");
-
 
164
                                    
164
                                	 add_to_storage_set("resitems", seldata);
165
                                	 add_to_storage_set("resitems", seldata);
165
                                     var tblid="#pane1 #"+seldata+ " td";
166
                                     var tblid="#pane1 #"+seldata+ " td";
166
                                     $(tblid + " div a").truncate({addtitle: true});
167
                                     $(tblid + " div a").truncate({addtitle: true});
167
                                     $(tblid + " div div.price").truncate({addtitle: true});
168
                                     $(tblid + " div div.price").truncate({addtitle: true});
168
                                     $(tblid + " div div.text").truncate({addtitle: true});
169
                                     $(tblid + " div div.text").truncate({addtitle: true});
Line 190... Line 191...
190
          var isMulti = false;
191
          var isMulti = false;
191
          $(par).each(function(){
192
          $(par).each(function(){
192
        	  
193
        	  
193
	       	   var totalcolors = $(this).attr('totalcolors');
194
	       	   var totalcolors = $(this).attr('totalcolors');
194
	       	   //alert(totalcolors);
195
	       	   //alert(totalcolors);
195
	           if(totalcolors != 1){
-
 
196
	        	   isMulti = true; 
-
 
197
	       	   }
-
 
198
	           saprt = (tot>0)? "_":"";
196
	           saprt = (tot>0)? "_":"";
199
               seldata += saprt+$(this).attr('itemid');
197
               seldata += saprt+$(this).attr('itemid');
-
 
198
 
-
 
199
	           if(totalcolors != 1)	{
-
 
200
	        	   isMulti = true;
-
 
201
	       	   }
200
               tot++;
202
               tot++;
201
          });
203
          });
202
          //alert("ismulti" + isMulti + " seldata " + seldata + "   refdiv is "+ refdivid + "  par "+ par);
204
          //alert("ismulti" + isMulti + " seldata " + seldata + "   refdiv is "+ refdivid + "  par "+ par);
203
          if(isMulti == true){
205
          if(isMulti == true){
204
        	  alert("Some items are available in multiple colors. Please go to product page and select color you want.");
206
        	  alert("Some items are available in multiple colors. Please go to product page and select color you want.");
205
        	  return;
207
        	  return;
-
 
208
          } else	{
-
 
209
        	  var items = seldata.split('_');
-
 
210
        	  for(var i in items)	{
-
 
211
        		  trackEventWithGA('Order', 'Add to Cart', items[i]);
-
 
212
        	  }
206
          }
213
          }
207
     }else if(reqtype == "single"){
214
     }else if(reqtype == "single"){
208
          seldata = $("#item_id").val();
215
          seldata = $("#item_id").val();
-
 
216
		  trackEventWithGA('Order', 'Add to Cart', seldata + '');
209
          tot=1;
217
          tot=1;
210
     }else if(reqtype == "list"){
218
     }else if(reqtype == "list"){
211
    	  var seldata=refdivid;
219
    	  var seldata=refdivid;
-
 
220
		  trackEventWithGA('Order', 'Add to Cart', seldata + '');
212
          var tot=1;
221
          var tot=1;
213
     }
222
     }
214
     /*
223
     /*
215
     var historyitems = "";
224
     var historyitems = "";
216
     if($.Storage.get("historyitems")){
225
     if($.Storage.get("historyitems")){
217
    	 historyitems = "&historyitems=" +  $.Storage.get("historyitems");
226
    	 historyitems = "&historyitems=" +  $.Storage.get("historyitems");
218
    	 $.Storage.remove("historyitems");
227
    	 $.Storage.remove("historyitems");
219
     }
228
     }
220
     +historyitems
229
     +historyitems
221
     */
230
     */
222
     
231
 
223
     if(tot>0){
232
     if(tot > 0)	{
224
          //alert("AJAX request to add products in Cart. Product ID: "+seldata+" and total: "+tot); 
-
 
225
          jQuery.ajax({
233
    	 jQuery.ajax({
226
               type: "POST",
234
    		 type: "POST",
227
                      url: "/addtocart",
235
    		 url: "/addtocart",
228
                      data: "productid="+seldata,
236
    		 data: "productid=" + seldata,
229
                      success: function(msg){
237
    		 success: function(msg){
230
                           $("#cartItemCount").html(msg*1);
238
    			 $("#cartItemCount").html(msg * 1);
231
                           window.location="/cart";
239
    			 window.location = "/cart";
232
                           //alert( "Data Saved: " + msg );
-
 
233
                      }
240
    		 }
234
          });
241
    	 });
235
     }else{
242
     } else	{
236
          alert("Please select atleast one product");
243
    	 alert("Please select atleast one product");
237
     }
244
     }
238
     
-
 
239
}
245
}
240
 
246
 
241
function selectProduct(itemId){
247
function selectProduct(itemId){
242
	//alert("Selected item is "+ itemId);
248
	//alert("Selected item is "+ itemId);
243
}
249
}