Subversion Repositories SmartDukaan

Rev

Rev 8226 | Rev 8279 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6967 kshitij.so 1
function toggle(containerId){
2
        var divC = document.getElementById(containerId);
3
        if (divC.style.display == 'none') {
4
            divC.style.display = 'block';
5
        } else if (divC.style.display == 'block'){
6
            divC.style.display = 'none';
7
        }
8
        else {
9
        	divC.style.display = 'none';
10
        }
11
    }
12
 
4126 varun.gupt 13
$(function(){
4984 varun.gupt 14
	function CollapsibleWidget(container)	{
15
 
16
		this.widgetContainer = container;
17
		this.collapsbiles = $(container).children('.common-widget-control-bar, .common-widget-content-area');
18
		this.isCollapsed = null;
19
 
20
		this.collapse = function()	{
21
			$(this.collapsbiles).each(function()	{
22
				$(this).slideUp();
23
			});
24
			this.isCollapsed = true;
25
		};
26
 
27
		this.open = function()	{
28
			$(this.collapsbiles).each(function()	{
29
				$(this).slideDown();
30
			});
31
			this.isCollapsed = false;
32
		};
33
 
34
		this.test = function()	{
35
		};
36
	}
4798 varun.gupt 37
 
4984 varun.gupt 38
	ResearchWidget.prototype = new CollapsibleWidget();
39
	ResearchWidget.prototype.constructor = CollapsibleWidget;
40
 
41
	function ResearchWidget(container)	{
42
		CollapsibleWidget.call(this, container);
43
	}
44
 
4798 varun.gupt 45
	function updateCompareCount()	{
46
		$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length);
47
	}
48
 
4126 varun.gupt 49
	/** Sidebar Widgets **/
4237 varun.gupt 50
 
6840 kshitij.so 51
	$('#otg_know_more,.otg_know_more').click(function(){
6552 kshitij.so 52
		$.colorbox({
53
    		width: "490px",
6772 kshitij.so 54
    		height: "420px",
6552 kshitij.so 55
    		inline: true,
56
    		href: "<h3 style='text-align: center; margin: 18px; font-size: 14px;'>On Time Guarantee, We Pay if we Delay</h3>" +
57
		"<p style='text-align: justify; margin-left: 12px; margin-right: 12px; margin-bottom: 9px; line-height: 22px;'>Saholic stands for 100% on time delivery. We ensure all your orders reach your doorstep on or "+
58
        "before the promised delivery date. In the rare case that we deliver an order later than promised "+
59
        "we will compensate you.This Guarantee is Valid on"+
60
        "</p>" +
61
        "<ul style='list-style: disc none none; margin-left: 25px; text-align: justify; margin-right:12px; line-height: 22px;'><li>All Mobiles, Cameras, Laptops, Tablets and Accessories above Rs. 2000 in value."+
62
        "</li>"+
63
        "<li>Orders Placed using Credit/Debit Card, Net Banking, EMI, Prepaid Cash Cards."+
64
        "</li>"+
65
        "</ul>"+
6772 kshitij.so 66
        "<p style='text-align: justify; line-height: 22px; margin: 12px;'>Compensation for delay is in the form of Gift Vouchers at the rate of Rs. 50 per business day. " +
67
        "GV can be applied to ANY product on Saholic.com without limitation.</p>"+
7063 kshitij.so 68
        "<span class='right'><a target='_blank' href='/static/on-time-guarantee' style='margin-right: 12px; color: #006699';>Detailed Terms & Conditions</a></span>",
6552 kshitij.so 69
        onComplete: function(){
70
		trackEventWithGA('Widget', 'OTG Know More is clicked', '');
71
			}
72
    	});
73
	});
7680 rajveer 74
 
7809 rajveer 75
	$('#cod_know_more,.cod_know_more').click(function(){
7680 rajveer 76
		$.colorbox({
7872 rajveer 77
    		width: "400px",
78
    		height: "200px",
7680 rajveer 79
    		inline: true,
7898 amit.gupta 80
    		href: "<ul style='list-style:inside; margin-left: 25px; margin-right:12px; font-size:15px; line-height: 22px;'>"
7872 rajveer 81
    			+ "Expected Delivery Date for "
7873 rajveer 82
    			+"<li list-style:inside>Prepaid orders is " + $("#shipping_time .red").html() + "</li>"+
83
    			"<li list-style:inside>" + $("#shipping_time .cod").html() + "</li>"+
7809 rajveer 84
        "</ul>",
7680 rajveer 85
        onComplete: function(){
7809 rajveer 86
		trackEventWithGA('Widget', 'COD Know More is clicked', '');
7680 rajveer 87
			}
88
    	});
89
	});
90
 
7846 rajveer 91
 
4237 varun.gupt 92
	$('#shoppingExpInfo').click(function(){
93
		$.colorbox({
4284 varun.gupt 94
    		width: "550px",
95
    		height: "320px",
4237 varun.gupt 96
    		inline: true,
97
    		href: "<h3>Shopping with Saholic.com is completely safe</h3><br />" +
4284 varun.gupt 98
		"<b>1.</b> We are part of Spice Group - India's # 1 Mobile retailer.<br /><br />" +
99
		"<b>2.</b> We procure directly from the Manufacturers - Hence we only sell genuine products with full Manufacturer Warranty.<br /><br />" +
100
		"<b>3.</b> We provide free Next Day Delivery to most locations - You can check the delivery time to your location by entering your pin code on the product page.<br /><br />" +
6173 kshitij.so 101
		"<b>4.</b> We use the best Internet Security technology - Your payment is 100% secure.<br />",
4372 varun.gupt 102
			onComplete: function(){
6261 amit.gupta 103
				trackEventWithGA('Widget', 'Safe shopping sticky banner is clicked', '');
4372 varun.gupt 104
			}
4237 varun.gupt 105
    	});
106
	});
6245 kshitij.so 107
 
6552 kshitij.so 108
 
6970 kshitij.so 109
	$('.insuranceInfo').click(function(){
110
		$.colorbox({
111
    		width: "520px",
112
    		height: "280px",
113
    		inline: true,
114
    		href: "<h3 style='font-size:15px; text-align:center; font-weight:bold; margin-left:15px; margin-top:5px;margin-bottom:10px'>Exclusively at Saholic</h3>" +
115
    		"<ul style='text-align: justify; padding-right: 10px; width: 93%; padding-left: 16px; line-height: 25px;'>"+
116
    		"<li>Only Saholic brings to you an option to protect your smartphone against theft and burglary.</li>"+
117
    		"<li>While buying your favourite mobile from Saholic, you can opt for 1 year WorldWide theft insurance.</li>"+
118
    		"<li>Introductory offer - You can opt for insurance by paying an all inclusive nominal fee of 1.5% of price of your mobile.</li>"+
7062 kshitij.so 119
    		"<a target='_blank' href='/static/insurance-terms' style='float: right; text-decoration: none;color:#006699';>Detailed Terms and Conditions</a>"+
6970 kshitij.so 120
    		"</ul>",
121
			onComplete: function(){
122
				trackEventWithGA('Widget', 'Insurance sticky banner is clicked', '');
123
			}
124
    	});
125
	});
126
 
127
 
6959 kshitij.so 128
	$('.emiInfo').click(function(){
6453 kshitij.so 129
		$.colorbox({
6967 kshitij.so 130
    		width: "590px",
8255 kshitij.so 131
    		height: "400px",
6453 kshitij.so 132
    		inline: true,
7051 kshitij.so 133
    		href: "<h3 style='font-size: 15px; text-align: center; font-weight: bold; margin-left: 15px; margin-bottom: 10px; margin-top: 7px;'>Completely Free EMI For 3 Months</h3>" +
6967 kshitij.so 134
    		"<div style='display: inline-block; padding-left: 5px;' class='bank-logo'><img src='/images/hdfc-icon.png' style='vertical-align: middle;'></div>"+
8255 kshitij.so 135
    		"<div class='emi-text' style='text-align: justify; height: 49px; padding-left: 3px; width: 397px; display: inline-block;'><p style='height: 38px; width: 420px;'>Available for 3, 6, 9, 12 and 18 months.Completely free for 3 months</p></div>"+
136
    		"<div id='emi-table-hdfc' style='padding-left: 5px; display: block;'>"+
137
    		"<table width='90%' cellspacing='0' cellpadding='0' border='0' id='emiwidget' style='padding-top: 2px; padding-bottom: 2px; border-top-width: 0px; border-left-width: 0px;padding-left: 5px'>"+
6967 kshitij.so 138
    		"<thead>"+
139
            "<th style='border:1px solid gray;text-align: center;background-color: #F1F1F1;' colspan='5'>All Inclusive Processing Fee*</th>"+
140
            "</thead>"+
141
            "<tbody>"+
142
            "<tr>"+
143
            "<td style='border-width: 0px 0px 1px 1px; border-style: solid; border-color: gray;text-align: center; width: 9%;'>3 Months</th>"+
144
            "<td style='border-width: 0px 0px 1px 1px; border-style: solid; border-color: gray;text-align: center; width: 9%;'>6 Months</th>"+
145
            "<td style='border-width: 0px 0px 1px 1px; border-style: solid; border-color: gray;text-align: center; width: 9%;'>9 Months</th>"+
7011 kshitij.so 146
            "<td style='border-width: 0px 0px 1px 1px; border-style: solid; border-color: gray;text-align: center; width: 9%;'>12 Months</th>"+
147
            "<td style='border-width: 0px 1px 1px 1px; border-style: solid; border-color: gray;text-align: center; width: 9%;'>18 Months</th>"+
6967 kshitij.so 148
            "</tr>"+
149
            "<tr>"+
150
            "<td style='border-bottom: 1px solid gray; border-left: 1px solid gray; border-right: 0px solid gray; text-align: center;'>Free</td>"+
151
            "<td style='border-bottom: 1px solid gray; border-left: 1px solid gray; border-right: 0px solid gray; text-align: center;'>4.22%</td>"+
152
            "<td style='border-bottom: 1px solid gray; border-left: 1px solid gray; border-right: 0px solid gray; text-align: center;'>7.04%</td>"+
7011 kshitij.so 153
            "<td style='border-bottom: 1px solid gray; border-left: 1px solid gray; border-right: 0px solid gray; text-align: center;'>9.67%</td>"+
154
            "<td style='border-bottom: 1px solid gray; border-left: 1px solid gray; border-right: 1px solid gray;text-align: center;'>15.36%</td>"+
6967 kshitij.so 155
            "</tr>"+
156
            "</tbody>"+
157
            "</table>"+
158
            "<br>"+
159
    		"<ul style='list-style : disc none none; padding-left: 20px; text-align:justify; line-height: 13px; padding-right: 10px; width: 83%;'>"+
160
    		"<li>Select EMI on Make Payment Page to see Monthly EMI payable and Total Amount Payable.</li>"+
6772 kshitij.so 161
    		"<br>"+
6967 kshitij.so 162
    		"<li>No charges will be levied by the bank.</li><br><li>Credit limit of full amount is needed and blocked at the time of buying on EMI.</li><br><li>As you pay the installments, correspondingly your credit limit increases.</li>"+
163
    		"</ul>"+
6959 kshitij.so 164
    		"<br>"+
8255 kshitij.so 165
    		"</div>",
6453 kshitij.so 166
			onComplete: function(){
167
				trackEventWithGA('Widget', 'Emi info widget is clicked', '');
168
			}
169
    	});
170
	});
6245 kshitij.so 171
 
6792 vikram.rag 172
	$('a.mk_best_deal_detail').live('click', function(){
173
		var offerLinkHtml = '';
174
		if(OFFER_HELP_LINK!='$OFFER_DETAIL_LINK') {
6795 vikram.rag 175
			offerLinkHtml = '<a target="_blank" href="' +OFFER_HELP_LINK + '" style="z-index: 1; float: right; bottom: 0px; right: 0px; margin: 15px; position: relative;">More</a></span>';
6792 vikram.rag 176
		}
177
		$.colorbox({
178
			width: "550px",
179
    		height: "300px",
180
    		inline: true,
181
    		href: '<h3 style="text-align: left; padding: 10px;">Offer Details</h3>' +
182
    			'<p style="text-align: justify; line-height: 22px; margin: 12px;">' + OFFER_HELP_TEXT +
183
    			'</p><span class="right">' + offerLinkHtml 
184
		});
185
	});
6453 kshitij.so 186
 
6792 vikram.rag 187
 
6245 kshitij.so 188
	$('#pickupstoreInfo').click(function(){
189
		$.colorbox({
190
    		width: "550px",
191
    		height: "370px",
192
    		inline: true,
193
    		href: "<h3>Frequently Asked Questions</h3><br />" +
7062 kshitij.so 194
		"<b style='color: black; cursor: default;'>Q)</b> What is 'Buy Online & Pickup in Store' ?<br /><br />" +
195
		"<b style='color: black; cursor: default;'>A)</b> Buy Online from Saholic.Com and pickup your product from the nearest Spice Hotspot Retail Store.<br /><br />" +
196
		"<b style='color: black; cursor: default;'>Q)</b> How do i avail this facility ?<br /><br />" +
197
		"<b style='color: black; cursor: default;'>A)</b> Simply select Pickup In Store On the Shipping Page and select your nearest store. Please note this facility is available only in Delhi/NCR.</a><br /><br />"+
198
		"<b style='color: black; cursor: default;'>Q)</b> When will the product be available for pickup ?<br /><br />" +
199
		"<b style='color: black; cursor: default;'>A)</b> You can enter your pin code on the Product Page to find estimated time to deliver. After placing the order we will also give you the estimated date for pickup.</a><br /><br />",
6245 kshitij.so 200
 
201
			onComplete: function(){
6262 amit.gupta 202
				var ev = "Product Page";
6303 amit.gupta 203
				var label = window.location.pathname;
6264 amit.gupta 204
				if (label=="" || label=="#")
6261 amit.gupta 205
				{
6303 amit.gupta 206
					label = "";
6262 amit.gupta 207
					ev = "Home Page";
6261 amit.gupta 208
				}
6262 amit.gupta 209
				else if (label.indexOf("shipping") != -1){
210
					ev = "Shipping Page";
211
					var blkstr = [];
6263 amit.gupta 212
					jQuery("#cartDetail").find("span.cart-item-name").each(function(key,str){
6262 amit.gupta 213
						blkstr.push(str);
214
					});
6303 amit.gupta 215
					label = blkstr.join(", ");
216
				} else if (label.substr(label.lastIndexOf('/') + 1).length==5 && typeof label.substr(label.lastIndexOf('/') + 1) =="number") {
217
					ev = "Category Page";
218
				} else if (label.substr(label.lastIndexOf('-') + 1).length==7  && typeof label.substr(label.lastIndexOf('-') + 1) =="number") {
219
					ev = "Product Page";
6262 amit.gupta 220
				}
6261 amit.gupta 221
				trackEventWithGA('Pickup in Store LightBox', ev, label);
6245 kshitij.so 222
			}
223
    	});
224
	});
4126 varun.gupt 225
 
5420 amit.gupta 226
	$('.common-widget-top-bar').live('click', function(e, callback){
4126 varun.gupt 227
		var isColapsed = $(this).data('is_colapsed') == true ? true : false;
228
		var widgetBox = $(this).siblings('.common-widget-content-area');
229
		var controlBox = $(this).siblings('.common-widget-control-bar');
230
		var controlBoxArrowImg = $(this).find('img');
4210 varun.gupt 231
 
4126 varun.gupt 232
		if (isColapsed)	{
233
			if(controlBox.length > 0)	{
234
				$(controlBox).slideDown('fast', function(){
5420 amit.gupta 235
					$(widgetBox).slideDown('fast', callback);
4126 varun.gupt 236
					$(controlBoxArrowImg).attr('src', '/images/IconDownArrow_UnselectedTab.png');
237
				});
238
			} else	{
239
				$(widgetBox).slideDown();
240
				$(controlBoxArrowImg).attr('src', '/images/IconDownArrow_UnselectedTab.png');
241
			}
242
		} else	{
243
			$(widgetBox).slideUp(function(){
244
				$(controlBox).slideUp('fast');
245
				$(controlBoxArrowImg).attr('src', '/images/IconRightArrow_UnselectedTab.png');
246
			});
247
		}
248
		$(this).data('is_colapsed', !isColapsed);
249
	});
250
 
251
	/**
252
	 * Update count of products checked for comparison
253
	 **/
254
	$('#myresearch input[type="checkbox"]').live('click', function(){
4798 varun.gupt 255
		updateCompareCount();
4126 varun.gupt 256
	});
257
 
258
	$("#research_compare").live('click', function(){
259
		var seldata = "";
5322 amit.gupta 260
		var prodnames = "";
4126 varun.gupt 261
		var tot = 1;
262
		var saprt = "";
263
		var par = $('#myresearch').find('input[type=checkbox]:checked');
4926 varun.gupt 264
		var haveSameProductType = true;
265
		var productType = null;
266
 
4126 varun.gupt 267
		$(par).each(function(){
4926 varun.gupt 268
 
269
			if(productType != null && productType != $(this).attr('producttype'))	{
270
				haveSameProductType = false;
271
			}
272
			productType = $(this).attr('producttype');
273
 
4126 varun.gupt 274
			if(tot == 1)	{
5358 amit.gupta 275
				prodnames += $(this).attr("title").replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
4126 varun.gupt 276
				seldata += "p" + tot + "=" + $(this).val();
277
			} else	{
278
				seldata += "&p" + tot + "=" + $(this).val();
5358 amit.gupta 279
				prodnames += "-vs-" + $(this).attr("title").replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();
4126 varun.gupt 280
			}
281
			tot ++;
282
		});
4984 varun.gupt 283
 
4926 varun.gupt 284
		if(! haveSameProductType)	{
285
			alert("Only products of same category can be compared");
286
		} else if(tot > 6)	{
4126 varun.gupt 287
			alert("Can compare upto five products only.");
288
		} else if(tot > 2)	{
5552 phani.kuma 289
			window.location = "/compare-" + productType.replace(/ +/g, '-').toLowerCase() + "/" + prodnames + "?" + seldata+"&fromsrc=comparison_widget";
4126 varun.gupt 290
		} else	{
291
			alert("Please select atleast two products");
292
		}
293
	});
294
 
295
	$("#research_delete").live('click', function(){
296
		var research_tot = $("#research_total").val();
297
		var seldata = [];
298
		var tot = 0;
299
		var saprt = "";
300
		var par = $('#myresearch').find('input[type=checkbox]:checked');
301
 
302
		$(par).each(function(){
303
			seldata.unshift($(this).val());
304
			tot ++;
305
		});
306
 
307
		if(tot > 0)	{
308
			var t = (research_tot * 1) - (tot * 1);
309
			$("#research_total").val(t);
310
 
311
			jQuery.ajax({
312
				type: "GET",
313
				url: "/deletefromresearch/[" + seldata + "]?_method=delete",
314
				success: function(msg)	{
315
					jQuery.each(seldata, function(intIndex, objValue){
316
						delete_from_storage_set("resitems", objValue);
317
						$("#myresearch").find("#" + objValue).fadeOut('slow', function() {
318
							$(this).remove();
319
							if(t === 0)	{
320
								$("#research_default").css("display", "block");
321
							}
322
						});
323
					});
4984 varun.gupt 324
 
4922 varun.gupt 325
					//Updating the count
326
					$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length - seldata.length);
4984 varun.gupt 327
 
328
					if ($('#myresearch input[type="checkbox"]').length - seldata.length <= 0)	{
329
						$("#myresearch").children(".common-widget-top-bar").trigger('click');
330
					}
4126 varun.gupt 331
				}
332
			});
333
		} else	{
334
			alert("Please select atleast one product");
335
		}
336
	});
337
 
338
	// No uid cookie
339
	if (!$.cookie("uid"))	{
340
		// No uid in storage
341
		if (!$.Storage.get("uid"))	{
342
			if (!$.Storage.get("resitems"))	{
343
				$.Storage.set("resitems", "[]");
344
			}
345
			if (!$.Storage.get("histitems"))	{
346
				$.Storage.set("histitems", "[]");
347
			}
348
		}
349
		else	{			// uid in storage : logout
350
			$.Storage.remove("uid");
351
			$.Storage.set("resitems", "[]");
352
			$.Storage.set("histitems", "[]");
353
		}
354
		load_research_widget();
355
		load_history_widget();
356
	}
357
	else	{				// With uid cookie
358
		var cookie = $.cookie("uid");
359
		// Just logged in merge storage items
360
		if (!$.Storage.get("uid"))	{
361
			$.Storage.set("uid", cookie);
362
			merge_history_items();
363
			load_research_items();
364
		}
365
		else	{
366
			// UID changed
367
			if ( cookie != $.Storage.get("uid"))	{
368
				$.Storage.set("uid", cookie);
369
				$.Storage.set("resitems", "[]");
370
				$.Storage.set("histitems", "[]");
371
				merge_history_items();
372
				load_research_items();
373
			}
374
			else	{		// Uid is same
375
				if (!$.Storage.get("resitems"))	{
376
					$.Storage.set("resitems", "[]");
377
					load_research_items();
378
				}
379
				else	{
380
					load_research_widget();
381
				}
382
 
383
				if (!$.Storage.get("histitems"))	{
384
					$.Storage.set("histitems", "[]");
385
					merge_history_items();
386
				}
387
				else	{
388
					load_history_widget();
389
				}
390
			}
391
		}
392
	}
4798 varun.gupt 393
 
394
	function load_research_items(){
395
		jQuery.ajax({
396
			type: "GET",
397
			url: "/myresearch",
398
			cache: false,
399
			success: function(json) {
400
			    $.Storage.set("resitems", json);
401
			    load_research_widget();
402
		    }
403
		});
404
	}
405
 
406
	function load_research_widget(){
407
		var myResearchWidgetContainer = $("#myresearch");
408
 
409
		if($(myResearchWidgetContainer).length == 0) {
410
			return;
411
		}
412
		var resitems = $.Storage.get("resitems");
413
 
414
		if (resitems == "[]") {
415
			var emptyResWidgetHtml = '<table border="0" width="100%" cellspacing="1" cellpadding="0" id="research_default">\
416
		      <tbody>\
417
		        <tr><td align="center"><b>Add items to compare list</b></td></tr>\
418
		       </tbody>\
419
		      </table>';
420
			$(myResearchWidgetContainer).find(".common-widget-content-area").html(emptyResWidgetHtml);
421
			$(myResearchWidgetContainer).children(".common-widget-top-bar").trigger('click');
422
			return;
423
		}
424
		var params = "/" + resitems;
425
 
426
		jQuery.ajax({
427
			type : "GET",
428
			url : "/myresearch" + params,
429
			cache: true,
430
			success : function(html) {
431
	   		    $("#myresearch").html(html);
432
	   			updateCompareCount();
433
 
434
			    // Product Title
435
			    $("#myresearch table td div a.truncate").each(function() {
436
						$(this).truncate({addtitle : true});
437
			    });
438
 
439
			    // Product Price
440
			    $("#myresearch table td div div.price").each(function() {
441
						$(this).truncate({addtitle : true});
442
				});
443
 
444
			    // Product Details
445
			    $("#myresearch table td div div.text").each(function() {
446
						$(this).truncate( {addtitle : true});
447
				});
448
		    }
449
		});
450
	}
7846 rajveer 451
});
452
 
7849 rajveer 453
function displayCod(item_id)	{
7846 rajveer 454
	$.colorbox({
7872 rajveer 455
		width: "400px",
456
		height: "200px",
7846 rajveer 457
		inline: true,
7873 rajveer 458
		href: "<ul style='list-style:inside; margin-left: 25px; text-align: justify; margin-right:12px; font-size:15px; line-height: 22px;'>"
7872 rajveer 459
			+ "Expected Delivery Date for "
7873 rajveer 460
			+"<li list-style:inside>Prepaid orders is " + $('#days_' + item_id).html() + "</li>"+
7879 rajveer 461
			"<li list-style:inside>Cash On Delivery orders is " + $('#coddays_' + item_id).html() + "</li>"+
7846 rajveer 462
    "</ul>",
463
    onComplete: function(){
464
	trackEventWithGA('Widget', 'COD Know More is clicked', '');
465
		}
466
	});
467
}