Subversion Repositories SmartDukaan

Rev

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

Rev 5831 Rev 6561
Line 1... Line 1...
1
var totalAmount = 0.00;
1
var totalAmount = 0.00;
2
 
2
 
3
$(document).ready(function(){
3
$(document).ready(function(){
4
 
4
 
5
	checkIfUserHasAddress();
5
	checkIfUserHasAddress();
-
 
6
	if(window.location.pathname === "/cart") {
-
 
7
		changeEstimate();
6
	
8
	}
7
	$('#checkout').click(function(){
9
	$('#checkout').click(function(){
8
		window.location.href = "/shipping";
10
		window.location.href = "/shipping";
9
	});
11
	});
10
	
12
	
11
	$('#poplogin').click(function(){
13
	$('#poplogin').click(function(){
Line 186... Line 188...
186
	} else	{
188
	} else	{
187
		jQuery.ajax({
189
		jQuery.ajax({
188
			type: "GET",
190
			type: "GET",
189
			url: "/estimate/" + $("#zipcode").val() + "_" + item_id,
191
			url: "/estimate/" + $("#zipcode").val() + "_" + item_id,
190
			beforeSend: function(){
192
			beforeSend: function(){
191
				$("#days" + "_" + item_id).html("<img src='/images/loader_l.gif'>");
193
				$("#img" + "_" + item_id).html("<img src='/images/loader_l.gif'>").show();
192
				$("#shipping_time_" + item_id).html('<img src="/images/loader_l.gif">');
194
				$("#block" + "_" + item_id).hide();
-
 
195
				$("#serv_" + item_id).hide();
193
			},
196
			},
194
			success: function(data){
197
			success: function(data){
-
 
198
				$("#img" + "_" + item_id).html("<img src='/images/loader_l.gif'>").hide();
195
				var response = eval('(' + data + ')');
199
				var response = eval('(' + data + ')');
196
				var deliveryEstimate = parseInt(response['delivery_estimate']);
200
				var deliveryEstimate = parseInt(response['delivery_estimate']);
-
 
201
				var otg= response['on_time_guarantee'];
197
				
202
				
198
				if(deliveryEstimate == -1)	{
203
				if(deliveryEstimate == -1)	{
199
					$("#shipping_time_" + item_id).html('Location is not serviceable');
204
					$("#serv_" + item_id).show();
-
 
205
					return;
200
					
206
					
201
				} else if(deliveryEstimate == 1)	{
207
				} else if(deliveryEstimate == 1)	{
202
					$("#shipping_time" + "_" + item_id).html('FREE DELIVERY in 1 Business Day');
208
					$("#days_" + item_id).html('1 Business Day');
203
				}
209
				}
204
				else	{
210
				else	{
205
					$("#shipping_time" + "_" + item_id).html('FREE DELIVERY in ' + deliveryEstimate + ' Business Days');
211
					$("#days_" + item_id).html(deliveryEstimate + ' Business Days');
-
 
212
				}
-
 
213
				if(otg == "true")	{
-
 
214
					$("#otg_" + item_id).show();
-
 
215
				} else {
-
 
216
					$("#otg_" + item_id).hide();
206
				}
217
				}
-
 
218
				$("#block" + "_" + item_id).show();
207
			}
219
			}
208
		});
220
		});
209
	}
221
	}
210
}
222
}
211
223