Subversion Repositories SmartDukaan

Rev

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

Rev 10537 Rev 11672
Line 105... Line 105...
105
			$.each(Entity.orderedItems, function(index, sort) {
105
			$.each(Entity.orderedItems, function(index, sort) {
106
				select.find('option[value="' + sort + '"]').appendTo(select);
106
				select.find('option[value="' + sort + '"]').appendTo(select);
107
			});
107
			});
108
			$("#item_id").val(Entity.orderedItems[0]);
108
			$("#item_id").val(Entity.orderedItems[0]);
109
			onColorSelectorChange(Entity.orderedItems[0]);
109
			onColorSelectorChange(Entity.orderedItems[0]);
-
 
110
			if(typeof deliveryEstimate != 'undefined') {
-
 
111
				$("#shipping_time").show();
-
 
112
				$("#shipping_time_1").hide();
-
 
113
				//$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");
-
 
114
				populateEstimate(deliveryEstimate);
-
 
115
			}else{
-
 
116
				updateEstimate(Entity.orderedItems[0]);
-
 
117
			}
110
		}
118
		}
111
		select.find("option:eq(0)").remove();
119
		select.find("option:eq(0)").remove();
112
	}
120
	}
113
 
121
 
114
    var prodid = $("#product_id").val();
122
    var prodid = $("#product_id").val();
Line 162... Line 170...
162
	});
170
	});
163
	
171
	
164
	$("#colorSelector").change(function(){
172
	$("#colorSelector").change(function(){
165
		var itemid = $("#colorSelector option:selected").val();
173
		var itemid = $("#colorSelector option:selected").val();
166
		onColorSelectorChange(itemid);
174
		onColorSelectorChange(itemid);
-
 
175
		updateEstimate(itemid);
167
		return false;
176
		return false;
168
	});
177
	});
169
	
178
	
170
	$(".util_compare").click(function() {
179
	$(".util_compare").click(function() {
171
		$.colorbox({
180
		$.colorbox({
Line 269... Line 278...
269
	} else	{
278
	} else	{
270
		document.getElementById("signinClass").className = 'signin1';
279
		document.getElementById("signinClass").className = 'signin1';
271
	}
280
	}
272
}
281
}
273
 
282
 
-
 
283
function populateEstimate(msg) {
-
 
284
	var response = eval('(' + msg + ')');
-
 
285
	var deliveryEstimate = response['delivery_estimate'];
-
 
286
	var codDeliveryEstimate = response['cod_delivery_estimate'];
-
 
287
	var isCODAvailableForLocation = (response['is_cod_available_for_location'] === 'true');
-
 
288
	var isOTG = (response['on_time_guarantee'] === 'true');
-
 
289
	var businessDays = response['business_days'];
-
 
290
	
-
 
291
	if(deliveryEstimate == -1)	{
-
 
292
		$("#shipping_time").hide();
-
 
293
		$("#shipping_time_1").show();
-
 
294
		$('#cod_know_more').hide();
-
 
295
	} else	{
-
 
296
		$('#cod_know_more').hide();
-
 
297
		if($("#shipping_time").html().indexOf('after arrival')>-1){
-
 
298
			$("#shipping_time .red").html(businessDays + " Days");
-
 
299
		}else{
-
 
300
			if(isCODAvailableForLocation && (codDeliveryEstimate != deliveryEstimate)){
-
 
301
				$("#shipping_time .cod").html("Cash On Delivery orders is " + codDeliveryEstimate);
-
 
302
				$('#cod_know_more').show();
-
 
303
			}
-
 
304
			$("#shipping_time .red").html(deliveryEstimate);
-
 
305
		}
-
 
306
	}
-
 
307
	
-
 
308
	if (isCODAvailableForLocation)	{
-
 
309
		$('#cod').show();
-
 
310
	} else {
-
 
311
		$('#cod').hide();
-
 
312
	}
-
 
313
	
-
 
314
	if (isOTG)	{
-
 
315
		$('#otg').show();
-
 
316
	} else {
-
 
317
		$('#otg').hide();
-
 
318
	}
-
 
319
}
274
 
320
 
275
function updateEstimate(itemId)	{
321
function updateEstimate(itemId)	{
276
	itemId = itemId || $("#colorSelector option:selected").val();
322
	itemId = itemId || $("#colorSelector option:selected").val();
277
	
323
	
278
	jQuery.ajax({
324
	jQuery.ajax({
Line 282... Line 328...
282
			$("#shipping_time").show();
328
			$("#shipping_time").show();
283
			$("#shipping_time_1").hide();
329
			$("#shipping_time_1").hide();
284
			$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");
330
			$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");
285
		},
331
		},
286
		success: function(msg)	{
332
		success: function(msg)	{
287
			var response = eval('(' + msg + ')');
-
 
288
			var deliveryEstimate = response['delivery_estimate'];
-
 
289
			var codDeliveryEstimate = response['cod_delivery_estimate'];
-
 
290
			var isCODAvailableForLocation = (response['is_cod_available_for_location'] === 'true');
-
 
291
			var isOTG = (response['on_time_guarantee'] === 'true');
-
 
292
			var businessDays = response['business_days'];
-
 
293
			
-
 
294
			if(deliveryEstimate == -1)	{
333
			populateEstimate(msg);
295
				$("#shipping_time").hide();
-
 
296
				$("#shipping_time_1").show();
-
 
297
				$('#cod_know_more').hide();
-
 
298
			} else	{
-
 
299
				$('#cod_know_more').hide();
-
 
300
				if($("#shipping_time").html().indexOf('after arrival')>-1){
-
 
301
					$("#shipping_time .red").html(businessDays + " Days");
-
 
302
				}else{
-
 
303
					if(isCODAvailableForLocation && (codDeliveryEstimate != deliveryEstimate)){
-
 
304
						$("#shipping_time .cod").html("Cash On Delivery orders is " + codDeliveryEstimate);
-
 
305
						$('#cod_know_more').show();
-
 
306
					}
-
 
307
					$("#shipping_time .red").html(deliveryEstimate);
-
 
308
				}
-
 
309
			}
-
 
310
			
-
 
311
			if (isCODAvailableForLocation)	{
-
 
312
				$('#cod').show();
-
 
313
			} else {
-
 
314
				$('#cod').hide();
-
 
315
			}
-
 
316
			
-
 
317
			if (isOTG)	{
-
 
318
				$('#otg').show();
-
 
319
			} else {
-
 
320
				$('#otg').hide();
-
 
321
			}
-
 
322
		}
334
		}
323
	});
335
	});
324
}
336
}
325
 
337
 
326
function load_most_compared_widget(){
338
function load_most_compared_widget(){
Line 357... Line 369...
357
		$('#sp').html(PARAMETERS[itemid].SP);
369
		$('#sp').html(PARAMETERS[itemid].SP);
358
		$('#mrp').html(PARAMETERS[itemid].MRP);
370
		$('#mrp').html(PARAMETERS[itemid].MRP);
359
		$('#saving').html(PARAMETERS[itemid].SAVING);
371
		$('#saving').html(PARAMETERS[itemid].SAVING);
360
		$("#item_id").val(itemid);
372
		$("#item_id").val(itemid);
361
	}
373
	}
362
	updateEstimate(itemid);
-
 
363
}
374
}
364
 
375
 
365
banks = {};
376
banks = {};
366
var first = true;
377
var first = true;
367
for (obj in PARAMETERS) {
378
for (obj in PARAMETERS) {