| 11888 |
anikendra |
1 |
window.onload=function(){
|
|
|
2 |
var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
|
3 |
if(document.getElementsByClassName('cart-cont')[0] != undefined){
|
|
|
4 |
|
|
|
5 |
document.getElementsByClassName('cart-cont')[0].style.minHeight = pheight - 235 +'px';
|
|
|
6 |
}
|
|
|
7 |
};
|
|
|
8 |
|
|
|
9 |
function clearmsg() {
|
| 16123 |
manish.sha |
10 |
if (document.getElementById("cart-quantity-msg") !=null){
|
|
|
11 |
document.getElementById("cart-quantity-msg").innerHTML = '';
|
|
|
12 |
document.getElementById("cart-quantity-msg").style.display = 'none';
|
|
|
13 |
}
|
| 11888 |
anikendra |
14 |
if (document.getElementById("coupon-msg").style.display == "block") {
|
|
|
15 |
document.getElementById("coupon-msg").style.display = "none";
|
|
|
16 |
}
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
function applycoupon() {
|
|
|
20 |
var coupon = document.getElementById("couponcode").value;
|
| 17475 |
manish.sha |
21 |
var grandtotal = document.getElementById("grandtotal").innerHTML;
|
|
|
22 |
grandtotal = parseInt(grandtotal);
|
| 11888 |
anikendra |
23 |
if (coupon.length <= 0) {
|
|
|
24 |
if (document.getElementById("error").style.display == "block") {
|
|
|
25 |
document.getElementById("error").style.display = "none";
|
|
|
26 |
}
|
|
|
27 |
var bRed = document.getElementById("couponcode");
|
|
|
28 |
bRed.style.border = "red solid 1px";
|
|
|
29 |
bRed.style.color = "red";
|
|
|
30 |
bRed.value = "Please enter the coupon code!";
|
|
|
31 |
setTimeout(function() {
|
|
|
32 |
bRed.style.border = "";
|
|
|
33 |
bRed.style.color = "";
|
|
|
34 |
bRed.value = "";
|
|
|
35 |
}, 3000);
|
|
|
36 |
return false;
|
|
|
37 |
} else {
|
|
|
38 |
if (document.getElementById("error").style.display == "block") {
|
|
|
39 |
document.getElementById("error").style.display = "none";
|
|
|
40 |
}
|
|
|
41 |
var url = base_url + "cart/coupon/" + coupon;
|
|
|
42 |
microAjax(url, function(res) {
|
|
|
43 |
var data = JSON.parse(res);
|
|
|
44 |
var message = data.message;
|
|
|
45 |
document.getElementById("addCoupon").style.display = "block";
|
|
|
46 |
document.getElementById("coupon-msg").style.display = "block";
|
|
|
47 |
if (message.length > 0) {
|
|
|
48 |
document.getElementById("coupon-msg").innerHTML = message;
|
|
|
49 |
}
|
|
|
50 |
//if (data.discountedPrice != undefined && parseInt(data.discountedPrice) >= 0) {
|
|
|
51 |
if (data.couponCode != undefined && data.couponCode.length > 0) {
|
|
|
52 |
var dealtextdivs = document.getElementsByClassName('dealdiv');
|
|
|
53 |
for(var i in dealtextdivs){
|
|
|
54 |
if(dealtextdivs[i].innerHTML===undefined)continue;
|
|
|
55 |
var item_id = dealtextdivs[i].getAttribute('id');
|
|
|
56 |
dealtextdivs[i].innerHTML = data.dealTextArray[item_id];
|
|
|
57 |
if(data.dealTextArray[item_id]==''){
|
|
|
58 |
dealtextdivs[i].style.display='none';
|
|
|
59 |
}
|
|
|
60 |
}
|
|
|
61 |
//document.getElementById("addCoupon").style.display = "none";
|
|
|
62 |
document.getElementById("removeCoupon").style.display = "block";
|
|
|
63 |
if (data.couponCode.length > 0) {
|
|
|
64 |
document.getElementById("removeCoupon").innerHTML = "Remove Coupon: " + data.couponCode;
|
| 12524 |
anikendra |
65 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
66 |
_gaq.push(["_trackEvent", "COUPON", "Coupon Applied", data.couponCode]);
|
| 12524 |
anikendra |
67 |
}*/
|
|
|
68 |
ga('send', 'event', 'Coupon', 'Coupon Applied',data.couponCode);
|
| 11888 |
anikendra |
69 |
}else{
|
|
|
70 |
document.getElementById("removeCoupon").innerHTML = "Remove Coupon";
|
|
|
71 |
}
|
|
|
72 |
document.getElementById("discount").style.display = "block";
|
|
|
73 |
var discount = parseInt(data.totalPrice) - parseInt(data.discountedPrice);
|
|
|
74 |
document.getElementById("discountAmt").innerHTML = discount;
|
|
|
75 |
document.getElementById("discountPrice").style.display = "block";
|
|
|
76 |
document.getElementById("discountedPrice").innerHTML = parseInt(document.getElementById("total").innerHTML) - discount;
|
| 17475 |
manish.sha |
77 |
document.getElementById("grandtotal").innerHTML = grandtotal-discount;
|
| 11888 |
anikendra |
78 |
} else {
|
|
|
79 |
document.getElementById("discount").style.display = "none";
|
|
|
80 |
document.getElementById("discountPrice").style.display = "none";
|
|
|
81 |
}
|
|
|
82 |
});
|
| 16113 |
manish.sha |
83 |
Pace.stop();
|
| 11888 |
anikendra |
84 |
}
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
function clearcoupon(code) {
|
|
|
88 |
var url = base_url + "cart/couponClear/" + code;
|
|
|
89 |
microAjax(url, function(res) {
|
| 12524 |
anikendra |
90 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
91 |
_gaq.push(["_trackEvent", "COUPON", "Coupon Removed", document.getElementById("couponcode").value]);
|
| 12524 |
anikendra |
92 |
}*/
|
|
|
93 |
ga('send', 'event', 'Coupon', 'Coupon Removed',document.getElementById("couponcode").value);
|
| 11888 |
anikendra |
94 |
var data = JSON.parse(res);
|
|
|
95 |
var message = data.message;
|
|
|
96 |
var total = data.totalPrice;
|
|
|
97 |
document.getElementById("addCoupon").style.display = "block";
|
|
|
98 |
document.getElementById("removeCoupon").style.display = "none";
|
| 17477 |
manish.sha |
99 |
document.getElementById("grandtotal").innerHTML = parseInt(document.getElementById("grandtotal").innerHTML)+parseInt(document.getElementById("discountAmt").innerHTML);
|
| 11888 |
anikendra |
100 |
document.getElementById("discount").style.display = "none";
|
|
|
101 |
document.getElementById("discountPrice").style.display = "none";
|
|
|
102 |
document.getElementById("coupon-msg").style.display = "none";
|
|
|
103 |
document.getElementById("couponcode").value = "";
|
|
|
104 |
var finalinsurance = 0;
|
|
|
105 |
if (insuredItems.length > 0) {
|
|
|
106 |
for ( j = 0; j < insuredItems.length; j++) {
|
|
|
107 |
var insurance = insuredItems[j] + "theft";
|
|
|
108 |
var cost = document.getElementById(insurance).innerHTML;
|
|
|
109 |
finalinsurance = finalinsurance + parseInt(cost);
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
if (parseInt(finalinsurance) > 0) {
|
|
|
113 |
total = parseInt(total) + parseInt(finalinsurance);
|
|
|
114 |
document.getElementById("total").innerHTML = total;
|
|
|
115 |
}
|
|
|
116 |
});
|
| 16113 |
manish.sha |
117 |
Pace.stop();
|
| 11888 |
anikendra |
118 |
}
|
|
|
119 |
|
|
|
120 |
function updateQty(e) {
|
|
|
121 |
var oldValue = e.currentTarget.getAttribute("data-value");
|
|
|
122 |
var newvalue = e.currentTarget.value;
|
|
|
123 |
if (parseInt(newvalue) != parseInt(oldValue)) {
|
|
|
124 |
var url = base_url + "cart/update/" + e.currentTarget.id + "/" + newvalue;
|
|
|
125 |
window.location.href = url;
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
|
| 15933 |
manish.sha |
129 |
function updateQuantity(itemId, oldValue){
|
|
|
130 |
var newvalue = document.getElementById("qty_"+itemId).value;
|
| 16035 |
manish.sha |
131 |
if(parseInt(newvalue)>20){
|
| 16040 |
manish.sha |
132 |
document.getElementById("max-quantity-msg").style.display="block";
|
| 16064 |
manish.sha |
133 |
document.getElementById("qty_"+itemId).value=parseInt(oldValue);
|
| 16063 |
manish.sha |
134 |
document.getElementById('cart-quantity-msg').innerHTML = '';
|
|
|
135 |
document.getElementById('cart-quantity-msg').style.display = 'none';
|
| 16035 |
manish.sha |
136 |
return;
|
|
|
137 |
}
|
| 15933 |
manish.sha |
138 |
if (parseInt(newvalue) != parseInt(oldValue)) {
|
|
|
139 |
var url = base_url + "cart/update/" + itemId + "/" + newvalue;
|
| 16048 |
manish.sha |
140 |
Pace.start();
|
|
|
141 |
window.location.href = url;
|
| 15933 |
manish.sha |
142 |
}
|
|
|
143 |
}
|
|
|
144 |
|
| 11888 |
anikendra |
145 |
function removeItem(itemId) {
|
|
|
146 |
var url = base_url + "cart/delete/" + itemId;
|
|
|
147 |
window.location.href = url;
|
|
|
148 |
}
|
|
|
149 |
|
| 15933 |
manish.sha |
150 |
function showQtyConfirmButton(itemId){
|
| 15952 |
manish.sha |
151 |
document.getElementById("confirmQty_"+itemId).style.display = "block";
|
| 15933 |
manish.sha |
152 |
}
|
|
|
153 |
|
| 11888 |
anikendra |
154 |
var insuredItems = new Array();
|
|
|
155 |
function teftinsure(e) {
|
|
|
156 |
var key = e.currentTarget.getAttribute("data-key");
|
|
|
157 |
if (key == "ins") {
|
|
|
158 |
if (document.getElementById("error").style.display == "block") {
|
|
|
159 |
document.getElementById("error").style.display = "none";
|
|
|
160 |
}
|
|
|
161 |
var id = e.currentTarget.id;
|
|
|
162 |
var insure = document.getElementById(id).checked;
|
|
|
163 |
var itemId = e.currentTarget.getAttribute("data-value");
|
|
|
164 |
var tnc = itemId + "tnc";
|
|
|
165 |
var tc = itemId + "tc";
|
|
|
166 |
tncChkd = document.getElementById(tnc).checked;
|
|
|
167 |
var theft = itemId + "theft";
|
|
|
168 |
var theft = document.getElementById(theft).innerHTML;
|
|
|
169 |
theft = parseInt(theft);
|
|
|
170 |
var total = document.getElementById("total").innerHTML;
|
| 17475 |
manish.sha |
171 |
var grandtotal = document.getElementById("grandtotal").innerHTML;
|
| 11888 |
anikendra |
172 |
total = parseInt(total);
|
| 17475 |
manish.sha |
173 |
grandtotal = parseInt(grandtotal);
|
| 11888 |
anikendra |
174 |
if (insure == true) {
|
|
|
175 |
insuredItems.push(itemId);
|
| 12524 |
anikendra |
176 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
177 |
_gaq.push(["_trackEvent", "insurance", "Want Insurance", itemId]);
|
| 12524 |
anikendra |
178 |
}*/
|
|
|
179 |
ga('send', 'event', 'Insurance', 'Want Insurance',itemId);
|
| 17475 |
manish.sha |
180 |
document.getElementById("grandtotal").innerHTML = grandtotal + theft;
|
| 11888 |
anikendra |
181 |
if (document.getElementById("discountPrice").style.display == "block") {
|
|
|
182 |
var discountPrice = document.getElementById("discountedPrice").innerHTML;
|
|
|
183 |
discountPrice = parseInt(discountPrice);
|
|
|
184 |
document.getElementById("discountedPrice").innerHTML = discountPrice + theft;
|
|
|
185 |
} else {
|
|
|
186 |
document.getElementById("total").innerHTML = total + theft;
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
if (insure == false) {
|
|
|
190 |
if (document.getElementById("error").style.display == "block") {
|
|
|
191 |
document.getElementById("error").style.display = "none";
|
|
|
192 |
}
|
|
|
193 |
if (document.getElementById(tc).style.display == "block") {
|
|
|
194 |
document.getElementById(tc).style.display = "none";
|
|
|
195 |
}
|
|
|
196 |
var ind = insuredItems.indexOf(itemId);
|
|
|
197 |
insuredItems.splice(ind, 1);
|
| 17475 |
manish.sha |
198 |
document.getElementById("grandtotal").innerHTML = grandtotal - theft;
|
| 11888 |
anikendra |
199 |
if (document.getElementById("discountPrice").style.display == "block") {
|
|
|
200 |
var discountPrice = document.getElementById("discountedPrice").innerHTML;
|
|
|
201 |
discountPrice = parseInt(discountPrice);
|
|
|
202 |
document.getElementById("discountedPrice").innerHTML = discountPrice - theft;
|
|
|
203 |
} else {
|
|
|
204 |
document.getElementById("total").innerHTML = total - theft;
|
|
|
205 |
}
|
|
|
206 |
}
|
|
|
207 |
}
|
|
|
208 |
if (key == "tnc") {
|
|
|
209 |
if (document.getElementById("error").style.display == "block") {
|
|
|
210 |
document.getElementById("error").style.display = "none";
|
|
|
211 |
}
|
|
|
212 |
var id = e.currentTarget.id;
|
|
|
213 |
var tncChkd = document.getElementById(id).checked;
|
|
|
214 |
var itemId = e.currentTarget.getAttribute("data-value");
|
|
|
215 |
var insurance = itemId + "insurance";
|
|
|
216 |
var tc = itemId + "tc";
|
|
|
217 |
var insure = document.getElementById(insurance).checked;
|
|
|
218 |
}
|
|
|
219 |
if (insure == true && tncChkd == false) {
|
|
|
220 |
if (document.getElementById("error").style.display == "block") {
|
|
|
221 |
document.getElementById("error").style.display = "none";
|
|
|
222 |
}
|
|
|
223 |
if (document.getElementById(tc).style.display == "block") {
|
|
|
224 |
var url = base_url + "cart/insure/" + itemId + "/" + tncChkd + "/1";
|
|
|
225 |
microAjax(url, function(res) {
|
|
|
226 |
var data = JSON.parse(res);
|
|
|
227 |
data = data.status;
|
|
|
228 |
if (data == true) {
|
|
|
229 |
}
|
|
|
230 |
if (data == false) {
|
|
|
231 |
alert(data);
|
|
|
232 |
}
|
|
|
233 |
});
|
|
|
234 |
} else {
|
|
|
235 |
document.getElementById(tc).style.display = "block";
|
|
|
236 |
}
|
|
|
237 |
} else {
|
|
|
238 |
if (insure == true && tncChkd == true) {
|
| 12524 |
anikendra |
239 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
240 |
_gaq.push(["_trackEvent", "Insurance", "Agreed to Terms", itemId]);
|
| 12524 |
anikendra |
241 |
}*/
|
|
|
242 |
ga('send', 'event', 'Insurance', 'Agreed to Terms',itemId);
|
| 11888 |
anikendra |
243 |
var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
|
|
|
244 |
microAjax(url, function(res) {
|
|
|
245 |
var data = JSON.parse(res);
|
|
|
246 |
data = data.status;
|
|
|
247 |
if (data == true) {
|
|
|
248 |
}
|
|
|
249 |
if (data == false) {
|
|
|
250 |
alert(data);
|
|
|
251 |
}
|
|
|
252 |
});
|
|
|
253 |
} else {
|
|
|
254 |
if (insure == false && tncChkd == true) {
|
|
|
255 |
var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
|
|
|
256 |
microAjax(url, function(res) {
|
|
|
257 |
var data = JSON.parse(res);
|
|
|
258 |
data = data.status;
|
|
|
259 |
if (data == true) {
|
|
|
260 |
document.getElementById(tnc).checked = false;
|
|
|
261 |
document.getElementById(tc).style.display = "none";
|
|
|
262 |
}
|
|
|
263 |
if (data == false) {
|
|
|
264 |
alert(data);
|
|
|
265 |
}
|
|
|
266 |
});
|
|
|
267 |
} else {
|
|
|
268 |
if (insure == false && tncChkd == true) {
|
|
|
269 |
var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
|
|
|
270 |
microAjax(url, function(res) {
|
|
|
271 |
var data = JSON.parse(res);
|
|
|
272 |
data = data.status;
|
|
|
273 |
if (data == true) {
|
|
|
274 |
document.getElementById(tnc).checked = false;
|
|
|
275 |
document.getElementById(tc).style.display = "none";
|
|
|
276 |
}
|
|
|
277 |
if (data == false) {
|
|
|
278 |
alert(data);
|
|
|
279 |
}
|
|
|
280 |
});
|
|
|
281 |
}
|
|
|
282 |
}
|
|
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
function dataprotection(e) {
|
|
|
288 |
var id = e.currentTarget.id;
|
|
|
289 |
var protection = document.getElementById(id).checked;
|
|
|
290 |
var itemId = e.currentTarget.getAttribute("data-value");
|
|
|
291 |
var url = base_url + "cart/insure/" + itemId + "/" + protection + "/2";
|
|
|
292 |
microAjax(url, function(res) {
|
|
|
293 |
var data = JSON.parse(res);
|
|
|
294 |
data = data.status;
|
|
|
295 |
if (data == true) {
|
|
|
296 |
}
|
|
|
297 |
if (data == false) {
|
|
|
298 |
}
|
|
|
299 |
});
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
function checkout() {
|
|
|
303 |
var chx = document.getElementsByClassName("checkbox");
|
|
|
304 |
for (var i = 0; i < chx.length; i++) {
|
|
|
305 |
if (chx[i].type == "checkbox" && chx[i].checked) {
|
|
|
306 |
var id = chx[i].getAttribute("data-value");
|
|
|
307 |
var tnc = id + "tnc";
|
|
|
308 |
if (document.getElementById(tnc).checked == false) {
|
| 12524 |
anikendra |
309 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
310 |
_gaq.push(["_trackEvent", "Insurance", "Alert for tnc"]);
|
| 12524 |
anikendra |
311 |
}*/
|
|
|
312 |
ga('send', 'event', 'Insurance', 'Alert for tnc');
|
| 11888 |
anikendra |
313 |
document.getElementById("error").style.display = "block";
|
|
|
314 |
document.getElementById("error").innerHTML = "Please agree to the terms and conditions to get insurance";
|
|
|
315 |
window.scrollTo(0, 0);
|
|
|
316 |
return false;
|
|
|
317 |
break;
|
|
|
318 |
}
|
|
|
319 |
}
|
|
|
320 |
}
|
|
|
321 |
if (locationServicable == false) {
|
|
|
322 |
var pincode = document.getElementById("pincode").value;
|
| 12524 |
anikendra |
323 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
324 |
_gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
|
| 12524 |
anikendra |
325 |
}*/
|
|
|
326 |
ga('send', 'event', 'Cart', 'Location not serviceable',pincode);
|
| 11888 |
anikendra |
327 |
document.getElementById("error").style.display = "block";
|
|
|
328 |
if (itemsNotServicable == items.length) {
|
|
|
329 |
document.getElementById("error").innerHTML = "Location not serviceable. Please try a different pincode";
|
|
|
330 |
} else {
|
|
|
331 |
if (itemsNotServicable != items.length) {
|
|
|
332 |
document.getElementById("error").innerHTML = "Location not serviceable for one of the products. Please try a different pincode or try removing the product";
|
|
|
333 |
}
|
|
|
334 |
}
|
|
|
335 |
window.scrollTo(0, 0);
|
|
|
336 |
return false;
|
|
|
337 |
}
|
|
|
338 |
if ((notServiceableLocation != undefined) && (notServiceableLocation != 0)) {
|
|
|
339 |
var pincode = document.getElementById("pincode").value;
|
| 12524 |
anikendra |
340 |
/*if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 11888 |
anikendra |
341 |
_gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
|
| 12524 |
anikendra |
342 |
}*/
|
|
|
343 |
ga('send', 'event', 'Cart', 'Location not serviceable',pincode);
|
| 11888 |
anikendra |
344 |
document.getElementById("error").style.display = "block";
|
|
|
345 |
if (notServiceableLocation == items.length) {
|
|
|
346 |
document.getElementById("error").innerHTML = "Location not serviceable. Please try a different pincode";
|
|
|
347 |
} else {
|
|
|
348 |
if (notServiceableLocation != items.length) {
|
|
|
349 |
document.getElementById("error").innerHTML = "Location not serviceable for one of the products. Please try a different pincode or try removing the product";
|
|
|
350 |
}
|
|
|
351 |
}
|
|
|
352 |
window.scrollTo(0, 0);
|
|
|
353 |
return false;
|
|
|
354 |
}
|
|
|
355 |
window.location.href = base_url + "shipping";
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
var j = 0;
|
|
|
359 |
var locationServicable;
|
|
|
360 |
var itemsNotServicable = 0;
|
|
|
361 |
function checkShipping() {
|
|
|
362 |
if (j != 0) {
|
|
|
363 |
j = 0;
|
|
|
364 |
}
|
|
|
365 |
if (itemsNotServicable != 0) {
|
|
|
366 |
itemsNotServicable = 0;
|
|
|
367 |
}
|
|
|
368 |
var pincode = document.getElementById("pincode").value;
|
|
|
369 |
pincode = pincode.trim();
|
|
|
370 |
if (/^\d+$/.test(pincode) && pincode.length == 6) {
|
|
|
371 |
if (document.getElementById("error")) {
|
|
|
372 |
document.getElementById("error").style.display = "none";
|
|
|
373 |
}
|
|
|
374 |
for ( i = 0; i < items.length; i++) {
|
|
|
375 |
itemId = items[i].id;
|
|
|
376 |
var url = base_url + "productinfo/getDeliveryDetails/" + itemId + "/" + pincode;
|
|
|
377 |
j = i;
|
|
|
378 |
microAjax(url, function(res) {
|
|
|
379 |
if (res != "") {
|
|
|
380 |
data = JSON.parse(res);
|
|
|
381 |
days = data.business_days;
|
|
|
382 |
if (days >= 0) {
|
|
|
383 |
locationServicable = true;
|
|
|
384 |
var service = items[j].id + "service";
|
|
|
385 |
document.getElementById(service).style.display = "none";
|
|
|
386 |
var delivery = items[j].id + "delivery";
|
|
|
387 |
if (document.getElementById(delivery)) {
|
|
|
388 |
document.getElementById(delivery).style.display = "block";
|
|
|
389 |
var del = items[j].id + "del";
|
|
|
390 |
document.getElementById(del).innerHTML = data.delivery_estimate;
|
|
|
391 |
}
|
|
|
392 |
if (data.is_cod_available_for_location == true) {
|
|
|
393 |
var cod = items[j].id + "cod";
|
|
|
394 |
if (document.getElementById(cod).style.display == "none") {
|
|
|
395 |
document.getElementById(cod).style.display = "block";
|
|
|
396 |
}
|
|
|
397 |
}
|
|
|
398 |
if (data.on_time_guarantee == true) {
|
|
|
399 |
var otg = items[j].id + "otg";
|
|
|
400 |
if (document.getElementById(otg).style.display == "none") {
|
|
|
401 |
document.getElementById(otg).style.display = "block";
|
|
|
402 |
}
|
|
|
403 |
}
|
|
|
404 |
} else {
|
|
|
405 |
var del = items[j].id + "delivery";
|
|
|
406 |
document.getElementById(del).style.display = "none";
|
|
|
407 |
var cod = items[j].id + "cod";
|
|
|
408 |
document.getElementById(cod).style.display = "none";
|
|
|
409 |
var otg = items[j].id + "otg";
|
|
|
410 |
document.getElementById(otg).style.display = "none";
|
|
|
411 |
var service = items[j].id + "service";
|
|
|
412 |
document.getElementById(service).style.display = "block";
|
|
|
413 |
document.getElementById(service).innerHTML = "Location is not serviceable";
|
|
|
414 |
locationServicable = false;
|
|
|
415 |
itemsNotServicable++;
|
|
|
416 |
}
|
|
|
417 |
j--;
|
|
|
418 |
}
|
|
|
419 |
});
|
|
|
420 |
}
|
|
|
421 |
} else {
|
|
|
422 |
document.getElementById("error").style.display = "block";
|
|
|
423 |
document.getElementById("error").innerHTML = "Invalid pincode!";
|
|
|
424 |
}
|
|
|
425 |
}
|
|
|
426 |
|
| 17571 |
manish.sha |
427 |
function showMoreDeals(){
|
|
|
428 |
window.location.href = base_url+"private-deals/1";
|
|
|
429 |
}
|
|
|
430 |
|
|
|
431 |
function quickAddToCart(id,catalogId){
|
|
|
432 |
var email = document.getElementById("email").value;
|
|
|
433 |
email = email.trim();
|
|
|
434 |
var url = base_url+'cart/add/'+id+'/'+email+'/'+catalogId;
|
|
|
435 |
microAjax(url, function(res)
|
|
|
436 |
{
|
|
|
437 |
if(res!='')
|
|
|
438 |
{
|
|
|
439 |
|
|
|
440 |
data = JSON.parse(res);
|
|
|
441 |
if(data['addcart'][0].redirectUrl != undefined && data['addcart'][0].redirectUrl != ''){
|
|
|
442 |
//window.history.replaceState("",document.title, base_url+'cart');
|
|
|
443 |
/*if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
444 |
_gaq.push(['_trackEvent', 'Order', 'Add To Cart',itemId]);
|
|
|
445 |
}*/
|
|
|
446 |
ga('send', 'event', 'Order', 'Add To Cart',id);
|
|
|
447 |
var ua = navigator.userAgent.toLowerCase();
|
|
|
448 |
var redirectUrl = data['addcart'][0].redirectUrl;
|
|
|
449 |
var isIE = ua.indexOf('msie') !== -1;
|
|
|
450 |
if (isIE){
|
|
|
451 |
window.location.replace(base_url+redirectUrl);
|
|
|
452 |
}else{
|
|
|
453 |
window.location.href = base_url+redirectUrl;
|
|
|
454 |
}
|
|
|
455 |
}else if(data['addcart'][0].message != undefined){
|
|
|
456 |
window.location.href=base_url+document.getElementById(id+"-url").value;
|
|
|
457 |
}
|
|
|
458 |
}
|
|
|
459 |
});
|
|
|
460 |
}
|
|
|
461 |
|
| 11888 |
anikendra |
462 |
function shomoreredirect() {
|
|
|
463 |
window.location.href = base_url;
|
| 17571 |
manish.sha |
464 |
}
|