| Line 1... |
Line -... |
| 1 |
|
- |
|
| 2 |
window.onload=function(){
|
1 |
window.onload=function(){
|
| 3 |
var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
2 |
var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
| 4 |
if(document.getElementsByClassName('cart-cont')[0] != undefined){
|
3 |
if(document.getElementsByClassName('cart-cont')[0] != undefined){
|
| 5 |
|
4 |
|
| 6 |
document.getElementsByClassName('cart-cont')[0].style.minHeight = pheight - 235 +'px';
|
5 |
document.getElementsByClassName('cart-cont')[0].style.minHeight = pheight - 235 +'px';
|
| 7 |
}
|
6 |
}
|
| 8 |
};
|
7 |
};
|
| 9 |
|
8 |
|
| 10 |
function clearmsg(){
|
9 |
function clearmsg() {
|
| 11 |
if(document.getElementById('coupon-msg').style.display == 'block')
|
10 |
if (document.getElementById("coupon-msg").style.display == "block") {
|
| 12 |
document.getElementById('coupon-msg').style.display = 'none';
|
11 |
document.getElementById("coupon-msg").style.display = "none";
|
| - |
|
12 |
}
|
| 13 |
}
|
13 |
}
|
| - |
|
14 |
|
| 14 |
function applycoupon(){
|
15 |
function applycoupon() {
|
| 15 |
var coupon = document.getElementById('couponcode').value;
|
16 |
var coupon = document.getElementById("couponcode").value;
|
| 16 |
if(coupon.length <= 0){
|
17 |
if (coupon.length <= 0) {
|
| 17 |
if(document.getElementById('error').style.display == 'block'){
|
18 |
if (document.getElementById("error").style.display == "block") {
|
| 18 |
document.getElementById('error').style.display = "none";
|
19 |
document.getElementById("error").style.display = "none";
|
| 19 |
}
|
20 |
}
|
| 20 |
var bRed = document.getElementById('couponcode');
|
21 |
var bRed = document.getElementById("couponcode");
|
| 21 |
bRed.style.border = 'red solid 1px';
|
22 |
bRed.style.border = "red solid 1px";
|
| 22 |
bRed.style.color = 'red';
|
23 |
bRed.style.color = "red";
|
| 23 |
bRed.value = 'Please enter the coupon code!';
|
24 |
bRed.value = "Please enter the coupon code!";
|
| 24 |
setTimeout(function(){
|
25 |
setTimeout(function() {
|
| 25 |
bRed.style.border = '';
|
26 |
bRed.style.border = "";
|
| 26 |
bRed.style.color = '';
|
27 |
bRed.style.color = "";
|
| 27 |
bRed.value = '';
|
28 |
bRed.value = "";
|
| 28 |
},3000);
|
29 |
}, 3000);
|
| - |
|
30 |
return false;
|
| - |
|
31 |
} else {
|
| - |
|
32 |
if (document.getElementById("error").style.display == "block") {
|
| - |
|
33 |
document.getElementById("error").style.display = "none";
|
| - |
|
34 |
}
|
| - |
|
35 |
var url = base_url + "cart/coupon/" + coupon;
|
| - |
|
36 |
microAjax(url, function(res) {
|
| - |
|
37 |
var data = JSON.parse(res);
|
| - |
|
38 |
var message = data.message;
|
| - |
|
39 |
if (message.length > 0) {
|
| - |
|
40 |
message = message.split(":");
|
| - |
|
41 |
message = message[1];
|
| - |
|
42 |
}
|
| - |
|
43 |
document.getElementById("coupon-msg").style.display = "block";
|
| - |
|
44 |
if (message.length == 0) {
|
| - |
|
45 |
document.getElementById("coupon-msg").innerHTML = "Coupon Applied";
|
| - |
|
46 |
} else {
|
| - |
|
47 |
document.getElementById("coupon-msg").innerHTML = message;
|
| 29 |
return false;
|
48 |
return false;
|
| 30 |
}
|
- |
|
| 31 |
else{
|
- |
|
| 32 |
if(document.getElementById('error').style.display == 'block'){
|
- |
|
| 33 |
document.getElementById('error').style.display = "none";
|
- |
|
| 34 |
}
|
- |
|
| 35 |
var url = base_url+'cart/coupon/'+coupon;
|
- |
|
| 36 |
//window.location.href = a;
|
- |
|
| 37 |
microAjax(url, function (res) {
|
- |
|
| 38 |
var data = JSON.parse(res);
|
- |
|
| 39 |
var message = data.message;
|
- |
|
| 40 |
if(message.length > 0){
|
- |
|
| 41 |
message = message.split(':');
|
- |
|
| 42 |
message = message[1];
|
- |
|
| 43 |
}
|
49 |
}
|
| 44 |
document.getElementById('coupon-msg').style.display = 'block';
|
- |
|
| 45 |
if(message.length == 0){
|
- |
|
| 46 |
document.getElementById('coupon-msg').innerHTML = 'Coupon Applied';
|
- |
|
| 47 |
}
|
- |
|
| 48 |
else{
|
- |
|
| 49 |
document.getElementById('coupon-msg').innerHTML = message;
|
- |
|
| 50 |
return false;
|
- |
|
| 51 |
}
|
- |
|
| 52 |
if(data.discountedPrice != undefined && parseInt(data.discountedPrice) >=0){
|
50 |
if (data.discountedPrice != undefined && parseInt(data.discountedPrice) >= 0) {
|
| 53 |
document.getElementById('addCoupon').style.display = 'none';
|
51 |
document.getElementById("addCoupon").style.display = "none";
|
| 54 |
document.getElementById('removeCoupon').style.display = 'block';
|
52 |
document.getElementById("removeCoupon").style.display = "block";
|
| 55 |
if(data.couponCode.length > 0){
|
53 |
if (data.couponCode.length > 0) {
|
| 56 |
document.getElementById('removeCoupon').innerHTML = 'Remove Coupon: '+data.couponCode;
|
54 |
document.getElementById("removeCoupon").innerHTML = "Remove Coupon: " + data.couponCode;
|
| 57 |
}
|
55 |
}
|
| 58 |
document.getElementById('discount').style.display = 'block';
|
56 |
document.getElementById("discount").style.display = "block";
|
| 59 |
var discount = parseInt(data.totalPrice) - parseInt(data.discountedPrice);
|
57 |
var discount = parseInt(data.totalPrice) - parseInt(data.discountedPrice);
|
| 60 |
document.getElementById('discountAmt').innerHTML = discount;
|
58 |
document.getElementById("discountAmt").innerHTML = discount;
|
| 61 |
document.getElementById('discountPrice').style.display = 'block';
|
59 |
document.getElementById("discountPrice").style.display = "block";
|
| 62 |
document.getElementById('discountedPrice').innerHTML = parseInt(document.getElementById('total').innerHTML)-discount;
|
60 |
document.getElementById("discountedPrice").innerHTML = parseInt(document.getElementById("total").innerHTML) - discount;
|
| 63 |
}
|
61 |
}
|
| 64 |
});
|
62 |
});
|
| 65 |
}
|
63 |
}
|
| 66 |
}
|
- |
|
| 67 |
function clearcoupon(code){
|
- |
|
| 68 |
var url = base_url+'cart/couponClear/'+code;
|
- |
|
| 69 |
//window.location.href = a;
|
- |
|
| 70 |
microAjax(url, function (res) {
|
- |
|
| 71 |
var data = JSON.parse(res);
|
- |
|
| 72 |
var message = data.message;
|
- |
|
| 73 |
var total = data.totalPrice;
|
- |
|
| 74 |
document.getElementById('addCoupon').style.display = 'block';
|
- |
|
| 75 |
document.getElementById('removeCoupon').style.display = 'none';
|
- |
|
| 76 |
document.getElementById('discount').style.display = 'none';
|
- |
|
| 77 |
document.getElementById('discountPrice').style.display = 'none';
|
- |
|
| 78 |
document.getElementById('coupon-msg').style.display = 'none';
|
- |
|
| 79 |
document.getElementById('couponcode').value = '';
|
- |
|
| 80 |
var finalinsurance = 0;
|
- |
|
| 81 |
if(insuredItems.length > 0){
|
- |
|
| 82 |
for(j=0;j<insuredItems.length;j++){
|
- |
|
| 83 |
var insurance = insuredItems[j]+'theft';
|
- |
|
| 84 |
var cost = document.getElementById(insurance).innerHTML;
|
- |
|
| 85 |
finalinsurance = finalinsurance + parseInt(cost);
|
- |
|
| 86 |
}
|
- |
|
| 87 |
}
|
- |
|
| 88 |
if(parseInt(finalinsurance) > 0){
|
- |
|
| 89 |
total = parseInt(total) + parseInt(finalinsurance);
|
- |
|
| 90 |
document.getElementById('total').innerHTML = total;
|
- |
|
| 91 |
}
|
- |
|
| 92 |
});
|
- |
|
| 93 |
}
|
64 |
}
|
| - |
|
65 |
|
| 94 |
function updateQty(e){
|
66 |
function clearcoupon(code) {
|
| 95 |
var oldValue = e.currentTarget.getAttribute('data-value');
|
67 |
var url = base_url + "cart/couponClear/" + code;
|
| - |
|
68 |
microAjax(url, function(res) {
|
| - |
|
69 |
var data = JSON.parse(res);
|
| 96 |
var newvalue = e.currentTarget.value;
|
70 |
var message = data.message;
|
| 97 |
if(parseInt(newvalue) != parseInt(oldValue)){
|
71 |
var total = data.totalPrice;
|
| - |
|
72 |
document.getElementById("addCoupon").style.display = "block";
|
| 98 |
var url = base_url+'cart/update/'+e.currentTarget.id+'/'+newvalue;
|
73 |
document.getElementById("removeCoupon").style.display = "none";
|
| - |
|
74 |
document.getElementById("discount").style.display = "none";
|
| - |
|
75 |
document.getElementById("discountPrice").style.display = "none";
|
| - |
|
76 |
document.getElementById("coupon-msg").style.display = "none";
|
| - |
|
77 |
document.getElementById("couponcode").value = "";
|
| 99 |
window.location.href = url;
|
78 |
var finalinsurance = 0;
|
| - |
|
79 |
if (insuredItems.length > 0) {
|
| - |
|
80 |
for ( j = 0; j < insuredItems.length; j++) {
|
| - |
|
81 |
var insurance = insuredItems[j] + "theft";
|
| - |
|
82 |
var cost = document.getElementById(insurance).innerHTML;
|
| - |
|
83 |
finalinsurance = finalinsurance + parseInt(cost);
|
| - |
|
84 |
}
|
| - |
|
85 |
}
|
| - |
|
86 |
if (parseInt(finalinsurance) > 0) {
|
| - |
|
87 |
total = parseInt(total) + parseInt(finalinsurance);
|
| - |
|
88 |
document.getElementById("total").innerHTML = total;
|
| - |
|
89 |
}
|
| 100 |
}
|
90 |
});
|
| 101 |
}
|
91 |
}
|
| 102 |
|
92 |
|
| 103 |
function removeItem(itemId){
|
93 |
function updateQty(e) {
|
| - |
|
94 |
var oldValue = e.currentTarget.getAttribute("data-value");
|
| - |
|
95 |
var newvalue = e.currentTarget.value;
|
| - |
|
96 |
if (parseInt(newvalue) != parseInt(oldValue)) {
|
| 104 |
var url = base_url+'cart/delete/'+itemId;
|
97 |
var url = base_url + "cart/update/" + e.currentTarget.id + "/" + newvalue;
|
| 105 |
window.location.href = url;
|
98 |
window.location.href = url;
|
| - |
|
99 |
}
|
| 106 |
}
|
100 |
}
|
| 107 |
var insuredItems = new Array();
|
- |
|
| 108 |
function teftinsure(e){
|
- |
|
| 109 |
var key = e.currentTarget.getAttribute('data-key');
|
- |
|
| 110 |
if(key == 'ins'){
|
- |
|
| 111 |
if(document.getElementById('error').style.display == "block"){
|
- |
|
| 112 |
document.getElementById('error').style.display = "none";
|
- |
|
| 113 |
}
|
- |
|
| 114 |
var id = e.currentTarget.id;
|
- |
|
| 115 |
var insure = document.getElementById(id).checked;
|
- |
|
| 116 |
var itemId = e.currentTarget.getAttribute('data-value');
|
- |
|
| 117 |
var tnc = itemId+'tnc';
|
- |
|
| 118 |
var tc = itemId+'tc';
|
- |
|
| 119 |
tncChkd = document.getElementById(tnc).checked;
|
- |
|
| 120 |
var theft = itemId+'theft';
|
- |
|
| 121 |
var theft = document.getElementById(theft).innerHTML;
|
- |
|
| 122 |
theft = parseInt(theft);
|
- |
|
| 123 |
var total = document.getElementById('total').innerHTML;
|
- |
|
| 124 |
total = parseInt(total);
|
- |
|
| 125 |
if(insure == true){
|
- |
|
| 126 |
insuredItems.push(itemId);
|
- |
|
| 127 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
- |
|
| 128 |
_gaq.push(['_trackEvent', 'insurance', 'Want Insurance',itemId]);
|
- |
|
| 129 |
}
|
- |
|
| 130 |
if(document.getElementById('discountPrice').style.display == 'block'){
|
- |
|
| 131 |
var discountPrice = document.getElementById('discountedPrice').innerHTML;
|
- |
|
| 132 |
discountPrice = parseInt(discountPrice);
|
- |
|
| 133 |
document.getElementById('discountedPrice').innerHTML = discountPrice+theft;
|
- |
|
| 134 |
}
|
- |
|
| 135 |
else{
|
- |
|
| 136 |
document.getElementById('total').innerHTML = total+theft;
|
- |
|
| 137 |
}
|
- |
|
| 138 |
}
|
- |
|
| 139 |
if(insure == false){
|
- |
|
| 140 |
if(document.getElementById('error').style.display == "block"){
|
- |
|
| 141 |
document.getElementById('error').style.display = "none";
|
- |
|
| 142 |
}
|
- |
|
| 143 |
if(document.getElementById(tc).style.display == 'block'){
|
- |
|
| 144 |
document.getElementById(tc).style.display = 'none';
|
- |
|
| 145 |
}
|
- |
|
| 146 |
var ind = insuredItems.indexOf(itemId);
|
- |
|
| 147 |
insuredItems.splice(ind,1);
|
- |
|
| 148 |
if(document.getElementById('discountPrice').style.display == 'block'){
|
- |
|
| 149 |
var discountPrice = document.getElementById('discountedPrice').innerHTML;
|
- |
|
| 150 |
discountPrice = parseInt(discountPrice);
|
- |
|
| 151 |
document.getElementById('discountedPrice').innerHTML = discountPrice-theft;
|
- |
|
| 152 |
}
|
- |
|
| 153 |
else{
|
- |
|
| 154 |
document.getElementById('total').innerHTML = total-theft;
|
- |
|
| 155 |
}
|
- |
|
| 156 |
}
|
- |
|
| 157 |
}
|
- |
|
| 158 |
if(key == 'tnc'){
|
- |
|
| 159 |
if(document.getElementById('error').style.display == "block"){
|
- |
|
| 160 |
document.getElementById('error').style.display = "none";
|
- |
|
| 161 |
}
|
- |
|
| 162 |
var id = e.currentTarget.id;
|
- |
|
| 163 |
var tncChkd = document.getElementById(id).checked;
|
- |
|
| 164 |
var itemId = e.currentTarget.getAttribute('data-value');
|
- |
|
| 165 |
var insurance = itemId+'insurance'
|
- |
|
| 166 |
var tc = itemId+'tc';
|
- |
|
| 167 |
var insure = document.getElementById(insurance).checked;
|
- |
|
| 168 |
}
|
- |
|
| 169 |
if(insure == true && tncChkd == false){
|
- |
|
| 170 |
if(document.getElementById('error').style.display == "block"){
|
- |
|
| 171 |
document.getElementById('error').style.display = "none";
|
- |
|
| 172 |
}
|
- |
|
| 173 |
if(document.getElementById(tc).style.display == 'block'){
|
- |
|
| 174 |
var url = base_url+'cart/insure/'+itemId+'/'+tncChkd+'/1';
|
- |
|
| 175 |
microAjax(url, function (res) {
|
- |
|
| 176 |
var data = JSON.parse(res);
|
- |
|
| 177 |
data = data.status;
|
- |
|
| 178 |
if(data == true){
|
- |
|
| 179 |
}
|
- |
|
| 180 |
if(data == false){
|
- |
|
| 181 |
alert(data);
|
- |
|
| 182 |
}
|
- |
|
| 183 |
});
|
- |
|
| 184 |
}
|
- |
|
| 185 |
else{
|
- |
|
| 186 |
document.getElementById(tc).style.display = 'block';
|
- |
|
| 187 |
}
|
- |
|
| 188 |
}
|
- |
|
| 189 |
else if(insure == true && tncChkd == true){
|
- |
|
| 190 |
|
- |
|
| 191 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
- |
|
| 192 |
_gaq.push(['_trackEvent', 'Insurance', 'Agreed to Terms',itemId]);
|
- |
|
| 193 |
}
|
- |
|
| 194 |
var url = base_url+'cart/insure/'+itemId+'/'+insure+'/1';
|
- |
|
| 195 |
microAjax(url, function (res) {
|
- |
|
| 196 |
|
- |
|
| 197 |
var data = JSON.parse(res);
|
- |
|
| 198 |
data = data.status;
|
- |
|
| 199 |
if(data == true){
|
- |
|
| 200 |
}
|
- |
|
| 201 |
if(data == false){
|
- |
|
| 202 |
alert(data);
|
- |
|
| 203 |
}
|
- |
|
| 204 |
});
|
- |
|
| 205 |
}
|
- |
|
| 206 |
else if(insure == false && tncChkd == true){
|
- |
|
| 207 |
|
- |
|
| 208 |
var url = base_url+'cart/insure/'+itemId+'/'+insure+'/1';
|
- |
|
| 209 |
microAjax(url, function (res) {
|
- |
|
| 210 |
|
- |
|
| 211 |
var data = JSON.parse(res);
|
- |
|
| 212 |
data = data.status;
|
- |
|
| 213 |
if(data == true){
|
- |
|
| 214 |
document.getElementById(tnc).checked = false;
|
- |
|
| 215 |
document.getElementById(tc).style.display = 'none';
|
- |
|
| 216 |
}
|
- |
|
| 217 |
if(data == false){
|
- |
|
| 218 |
alert(data);
|
- |
|
| 219 |
}
|
- |
|
| 220 |
});
|
- |
|
| 221 |
}
|
- |
|
| 222 |
else if(insure == false && tncChkd == true){
|
- |
|
| 223 |
|
- |
|
| 224 |
var url = base_url+'cart/insure/'+itemId+'/'+insure+'/1';
|
- |
|
| 225 |
microAjax(url, function (res) {
|
- |
|
| 226 |
|
- |
|
| 227 |
var data = JSON.parse(res);
|
- |
|
| 228 |
data = data.status;
|
- |
|
| 229 |
if(data == true){
|
- |
|
| 230 |
document.getElementById(tnc).checked = false;
|
- |
|
| 231 |
document.getElementById(tc).style.display = 'none';
|
- |
|
| 232 |
}
|
- |
|
| 233 |
if(data == false){
|
- |
|
| 234 |
alert(data);
|
- |
|
| 235 |
}
|
- |
|
| 236 |
});
|
- |
|
| 237 |
}
|
- |
|
| 238 |
|
101 |
|
| - |
|
102 |
function removeItem(itemId) {
|
| - |
|
103 |
var url = base_url + "cart/delete/" + itemId;
|
| - |
|
104 |
window.location.href = url;
|
| 239 |
}
|
105 |
}
|
| 240 |
|
106 |
|
| - |
|
107 |
var insuredItems = new Array();
|
| 241 |
function dataprotection(e){
|
108 |
function teftinsure(e) {
|
| - |
|
109 |
var key = e.currentTarget.getAttribute("data-key");
|
| - |
|
110 |
if (key == "ins") {
|
| - |
|
111 |
if (document.getElementById("error").style.display == "block") {
|
| - |
|
112 |
document.getElementById("error").style.display = "none";
|
| - |
|
113 |
}
|
| - |
|
114 |
var id = e.currentTarget.id;
|
| - |
|
115 |
var insure = document.getElementById(id).checked;
|
| - |
|
116 |
var itemId = e.currentTarget.getAttribute("data-value");
|
| - |
|
117 |
var tnc = itemId + "tnc";
|
| - |
|
118 |
var tc = itemId + "tc";
|
| - |
|
119 |
tncChkd = document.getElementById(tnc).checked;
|
| - |
|
120 |
var theft = itemId + "theft";
|
| - |
|
121 |
var theft = document.getElementById(theft).innerHTML;
|
| - |
|
122 |
theft = parseInt(theft);
|
| - |
|
123 |
var total = document.getElementById("total").innerHTML;
|
| - |
|
124 |
total = parseInt(total);
|
| - |
|
125 |
if (insure == true) {
|
| - |
|
126 |
insuredItems.push(itemId);
|
| - |
|
127 |
if ( typeof _gaq != "undefined" && _gaq != null) {
|
| - |
|
128 |
_gaq.push(["_trackEvent", "insurance", "Want Insurance", itemId]);
|
| - |
|
129 |
}
|
| - |
|
130 |
if (document.getElementById("discountPrice").style.display == "block") {
|
| - |
|
131 |
var discountPrice = document.getElementById("discountedPrice").innerHTML;
|
| - |
|
132 |
discountPrice = parseInt(discountPrice);
|
| - |
|
133 |
document.getElementById("discountedPrice").innerHTML = discountPrice + theft;
|
| - |
|
134 |
} else {
|
| - |
|
135 |
document.getElementById("total").innerHTML = total + theft;
|
| - |
|
136 |
}
|
| - |
|
137 |
}
|
| - |
|
138 |
if (insure == false) {
|
| - |
|
139 |
if (document.getElementById("error").style.display == "block") {
|
| - |
|
140 |
document.getElementById("error").style.display = "none";
|
| - |
|
141 |
}
|
| - |
|
142 |
if (document.getElementById(tc).style.display == "block") {
|
| - |
|
143 |
document.getElementById(tc).style.display = "none";
|
| - |
|
144 |
}
|
| - |
|
145 |
var ind = insuredItems.indexOf(itemId);
|
| - |
|
146 |
insuredItems.splice(ind, 1);
|
| - |
|
147 |
if (document.getElementById("discountPrice").style.display == "block") {
|
| - |
|
148 |
var discountPrice = document.getElementById("discountedPrice").innerHTML;
|
| - |
|
149 |
discountPrice = parseInt(discountPrice);
|
| - |
|
150 |
document.getElementById("discountedPrice").innerHTML = discountPrice - theft;
|
| - |
|
151 |
} else {
|
| - |
|
152 |
document.getElementById("total").innerHTML = total - theft;
|
| - |
|
153 |
}
|
| - |
|
154 |
}
|
| 242 |
|
155 |
}
|
| - |
|
156 |
if (key == "tnc") {
|
| - |
|
157 |
if (document.getElementById("error").style.display == "block") {
|
| - |
|
158 |
document.getElementById("error").style.display = "none";
|
| - |
|
159 |
}
|
| 243 |
var id = e.currentTarget.id;
|
160 |
var id = e.currentTarget.id;
|
| 244 |
var protection = document.getElementById(id).checked;
|
161 |
var tncChkd = document.getElementById(id).checked;
|
| 245 |
var itemId = e.currentTarget.getAttribute('data-value');
|
162 |
var itemId = e.currentTarget.getAttribute("data-value");
|
| - |
|
163 |
var insurance = itemId + "insurance";
|
| - |
|
164 |
var tc = itemId + "tc";
|
| - |
|
165 |
var insure = document.getElementById(insurance).checked;
|
| - |
|
166 |
}
|
| - |
|
167 |
if (insure == true && tncChkd == false) {
|
| - |
|
168 |
if (document.getElementById("error").style.display == "block") {
|
| - |
|
169 |
document.getElementById("error").style.display = "none";
|
| - |
|
170 |
}
|
| - |
|
171 |
if (document.getElementById(tc).style.display == "block") {
|
| 246 |
var url = base_url+'cart/insure/'+itemId+'/'+protection+'/2';
|
172 |
var url = base_url + "cart/insure/" + itemId + "/" + tncChkd + "/1";
|
| 247 |
microAjax(url, function (res) {
|
173 |
microAjax(url, function(res) {
|
| - |
|
174 |
var data = JSON.parse(res);
|
| - |
|
175 |
data = data.status;
|
| - |
|
176 |
if (data == true) {
|
| - |
|
177 |
}
|
| - |
|
178 |
if (data == false) {
|
| - |
|
179 |
alert(data);
|
| - |
|
180 |
}
|
| - |
|
181 |
});
|
| - |
|
182 |
} else {
|
| - |
|
183 |
document.getElementById(tc).style.display = "block";
|
| 248 |
|
184 |
}
|
| - |
|
185 |
} else {
|
| - |
|
186 |
if (insure == true && tncChkd == true) {
|
| - |
|
187 |
if ( typeof _gaq != "undefined" && _gaq != null) {
|
| - |
|
188 |
_gaq.push(["_trackEvent", "Insurance", "Agreed to Terms", itemId]);
|
| - |
|
189 |
}
|
| - |
|
190 |
var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
|
| - |
|
191 |
microAjax(url, function(res) {
|
| 249 |
var data = JSON.parse(res);
|
192 |
var data = JSON.parse(res);
|
| 250 |
data = data.status;
|
193 |
data = data.status;
|
| 251 |
if(data == true){
|
194 |
if (data == true) {
|
| - |
|
195 |
}
|
| - |
|
196 |
if (data == false) {
|
| - |
|
197 |
alert(data);
|
| - |
|
198 |
}
|
| - |
|
199 |
});
|
| - |
|
200 |
} else {
|
| - |
|
201 |
if (insure == false && tncChkd == true) {
|
| - |
|
202 |
var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
|
| - |
|
203 |
microAjax(url, function(res) {
|
| - |
|
204 |
var data = JSON.parse(res);
|
| - |
|
205 |
data = data.status;
|
| - |
|
206 |
if (data == true) {
|
| 252 |
// document.getElementById(tnc).checked = false;
|
207 |
document.getElementById(tnc).checked = false;
|
| 253 |
// document.getElementById(tc).style.display = 'none';
|
208 |
document.getElementById(tc).style.display = "none";
|
| 254 |
}
|
209 |
}
|
| 255 |
if(data == false){
|
210 |
if (data == false) {
|
| 256 |
//alert(data);
|
211 |
alert(data);
|
| 257 |
}
|
212 |
}
|
| 258 |
});
|
213 |
});
|
| - |
|
214 |
} else {
|
| - |
|
215 |
if (insure == false && tncChkd == true) {
|
| - |
|
216 |
var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
|
| - |
|
217 |
microAjax(url, function(res) {
|
| - |
|
218 |
var data = JSON.parse(res);
|
| - |
|
219 |
data = data.status;
|
| - |
|
220 |
if (data == true) {
|
| - |
|
221 |
document.getElementById(tnc).checked = false;
|
| - |
|
222 |
document.getElementById(tc).style.display = "none";
|
| - |
|
223 |
}
|
| - |
|
224 |
if (data == false) {
|
| - |
|
225 |
alert(data);
|
| - |
|
226 |
}
|
| - |
|
227 |
});
|
| - |
|
228 |
}
|
| - |
|
229 |
}
|
| - |
|
230 |
}
|
| - |
|
231 |
}
|
| - |
|
232 |
}
|
| 259 |
|
233 |
|
| - |
|
234 |
function dataprotection(e) {
|
| - |
|
235 |
var id = e.currentTarget.id;
|
| - |
|
236 |
var protection = document.getElementById(id).checked;
|
| - |
|
237 |
var itemId = e.currentTarget.getAttribute("data-value");
|
| - |
|
238 |
var url = base_url + "cart/insure/" + itemId + "/" + protection + "/2";
|
| - |
|
239 |
microAjax(url, function(res) {
|
| - |
|
240 |
var data = JSON.parse(res);
|
| - |
|
241 |
data = data.status;
|
| - |
|
242 |
if (data == true) {
|
| - |
|
243 |
}
|
| - |
|
244 |
if (data == false) {
|
| - |
|
245 |
}
|
| - |
|
246 |
});
|
| 260 |
}
|
247 |
}
|
| - |
|
248 |
|
| 261 |
function checkout(){
|
249 |
function checkout() {
|
| 262 |
|
- |
|
| 263 |
var chx = document.getElementsByClassName('checkbox');
|
250 |
var chx = document.getElementsByClassName("checkbox");
|
| 264 |
for (var i=0; i<chx.length; i++) {
|
251 |
for (var i = 0; i < chx.length; i++) {
|
| 265 |
if (chx[i].type == 'checkbox' && chx[i].checked) {
|
252 |
if (chx[i].type == "checkbox" && chx[i].checked) {
|
| 266 |
var id = chx[i].getAttribute('data-value');
|
253 |
var id = chx[i].getAttribute("data-value");
|
| 267 |
var tnc = id+'tnc';
|
254 |
var tnc = id + "tnc";
|
| 268 |
if(document.getElementById(tnc).checked == false){
|
255 |
if (document.getElementById(tnc).checked == false) {
|
| 269 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
256 |
if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 270 |
_gaq.push(['_trackEvent', 'Insurance', 'Alert for tnc']);
|
257 |
_gaq.push(["_trackEvent", "Insurance", "Alert for tnc"]);
|
| 271 |
}
|
258 |
}
|
| 272 |
document.getElementById('error').style.display = "block";
|
259 |
document.getElementById("error").style.display = "block";
|
| 273 |
document.getElementById('error').innerHTML ='Please agree to the terms and conditions to get insurance';
|
260 |
document.getElementById("error").innerHTML = "Please agree to the terms and conditions to get insurance";
|
| 274 |
window.scrollTo(0,0);
|
261 |
window.scrollTo(0, 0);
|
| 275 |
return false;
|
262 |
return false;
|
| 276 |
break;
|
263 |
break;
|
| 277 |
}
|
264 |
}
|
| 278 |
}
|
265 |
}
|
| 279 |
}
|
266 |
}
|
| 280 |
if(locationServicable == false){
|
267 |
if (locationServicable == false) {
|
| 281 |
var pincode = document.getElementById('pincode').value;
|
268 |
var pincode = document.getElementById("pincode").value;
|
| 282 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
269 |
if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 283 |
_gaq.push(['_trackEvent', 'Cart', 'Location not serviceable',pincode]);
|
270 |
_gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
|
| 284 |
}
|
271 |
}
|
| 285 |
document.getElementById('error').style.display = "block";
|
272 |
document.getElementById("error").style.display = "block";
|
| 286 |
if(itemsNotServicable == items.length){
|
273 |
if (itemsNotServicable == items.length) {
|
| 287 |
document.getElementById('error').innerHTML ='Location not servicable. Please try a diferent pincode';
|
274 |
document.getElementById("error").innerHTML = "Location not servicable. Please try a diferent pincode";
|
| - |
|
275 |
} else {
|
| 288 |
}else if(itemsNotServicable != items.length){
|
276 |
if (itemsNotServicable != items.length) {
|
| 289 |
document.getElementById('error').innerHTML ='Location not servicable for one of the products. Please try a diferent pincode or try removing the product';
|
277 |
document.getElementById("error").innerHTML = "Location not servicable for one of the products. Please try a diferent pincode or try removing the product";
|
| - |
|
278 |
}
|
| 290 |
}
|
279 |
}
|
| 291 |
window.scrollTo(0,0);
|
280 |
window.scrollTo(0, 0);
|
| 292 |
return false;
|
281 |
return false;
|
| 293 |
}
|
282 |
}
|
| 294 |
if((notServiceableLocation != undefined) && (notServiceableLocation != 0)){
|
283 |
if ((notServiceableLocation != undefined) && (notServiceableLocation != 0)) {
|
| 295 |
var pincode = document.getElementById('pincode').value;
|
284 |
var pincode = document.getElementById("pincode").value;
|
| 296 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
285 |
if ( typeof _gaq != "undefined" && _gaq != null) {
|
| 297 |
_gaq.push(['_trackEvent', 'Cart', 'Location not serviceable',pincode]);
|
286 |
_gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
|
| 298 |
}
|
287 |
}
|
| 299 |
document.getElementById('error').style.display = "block";
|
288 |
document.getElementById("error").style.display = "block";
|
| 300 |
if(notServiceableLocation == items.length){
|
289 |
if (notServiceableLocation == items.length) {
|
| 301 |
document.getElementById('error').innerHTML ='Location not servicable. Please try a diferent pincode';
|
290 |
document.getElementById("error").innerHTML = "Location not servicable. Please try a diferent pincode";
|
| - |
|
291 |
} else {
|
| 302 |
}else if(notServiceableLocation != items.length){
|
292 |
if (notServiceableLocation != items.length) {
|
| 303 |
document.getElementById('error').innerHTML ='Location not servicable for one of the products. Please try a diferent pincode or try removing the product';
|
293 |
document.getElementById("error").innerHTML = "Location not servicable for one of the products. Please try a diferent pincode or try removing the product";
|
| - |
|
294 |
}
|
| 304 |
}
|
295 |
}
|
| 305 |
window.scrollTo(0,0);
|
296 |
window.scrollTo(0, 0);
|
| 306 |
return false;
|
297 |
return false;
|
| 307 |
}
|
298 |
}
|
| 308 |
window.location.href = base_url+'shipping';
|
299 |
window.location.href = base_url + "shipping";
|
| 309 |
}
|
300 |
}
|
| - |
|
301 |
|
| 310 |
var j=0;
|
302 |
var j = 0;
|
| 311 |
var locationServicable;
|
303 |
var locationServicable;
|
| 312 |
var itemsNotServicable=0;
|
304 |
var itemsNotServicable = 0;
|
| 313 |
function checkShipping(){
|
305 |
function checkShipping() {
|
| 314 |
|
- |
|
| 315 |
if(j != 0){
|
306 |
if (j != 0) {
|
| 316 |
j = 0;
|
307 |
j = 0;
|
| 317 |
}
|
308 |
}
|
| 318 |
var pincode = document.getElementById('pincode').value;
|
309 |
var pincode = document.getElementById("pincode").value;
|
| 319 |
if(/^\d+$/.test(pincode) && pincode.length == 6){
|
310 |
if (/^\d+$/.test(pincode) && pincode.length == 6) {
|
| 320 |
if(document.getElementById('error')){
|
311 |
if (document.getElementById("error")) {
|
| 321 |
document.getElementById('error').style.display = 'none';
|
312 |
document.getElementById("error").style.display = "none";
|
| 322 |
}
|
313 |
}
|
| 323 |
for(i=0;i<items.length;i++){
|
314 |
for ( i = 0; i < items.length; i++) {
|
| 324 |
itemId = items[i].id
|
315 |
itemId = items[i].id;
|
| 325 |
var url = base_url+'productinfo/getDeliveryDetails/'+itemId+'/'+pincode;
|
316 |
var url = base_url + "productinfo/getDeliveryDetails/" + itemId + "/" + pincode;
|
| 326 |
j=i;
|
317 |
j = i;
|
| 327 |
microAjax(url, function(res)
|
318 |
microAjax(url, function(res) {
|
| 328 |
{
|
- |
|
| 329 |
|
- |
|
| 330 |
//console.log(res);
|
- |
|
| 331 |
if(res!='')
|
319 |
if (res != "") {
|
| 332 |
{
|
- |
|
| 333 |
data = JSON.parse(res);
|
320 |
data = JSON.parse(res);
|
| 334 |
days = data.business_days;
|
321 |
days = data.business_days;
|
| 335 |
if(days >= 0){
|
322 |
if (days >= 0) {
|
| 336 |
var service = items[j].id+'service';
|
323 |
var service = items[j].id + "service";
|
| 337 |
document.getElementById(service).style.display = 'none';
|
324 |
document.getElementById(service).style.display = "none";
|
| 338 |
var delivery = items[j].id+'delivery';
|
325 |
var delivery = items[j].id + "delivery";
|
| 339 |
if(document.getElementById(delivery)){
|
326 |
if (document.getElementById(delivery)) {
|
| 340 |
document.getElementById(delivery).style.display = 'block';
|
327 |
document.getElementById(delivery).style.display = "block";
|
| 341 |
var del = items[j].id+'del';
|
328 |
var del = items[j].id + "del";
|
| 342 |
document.getElementById(del).innerHTML = data.delivery_estimate;
|
329 |
document.getElementById(del).innerHTML = data.delivery_estimate;
|
| 343 |
}
|
330 |
}
|
| 344 |
if(data.is_cod_available_for_location == true){
|
331 |
if (data.is_cod_available_for_location == true) {
|
| 345 |
var cod = items[j].id+'cod';
|
332 |
var cod = items[j].id + "cod";
|
| 346 |
if(document.getElementById(cod).style.display == 'none'){
|
333 |
if (document.getElementById(cod).style.display == "none") {
|
| 347 |
document.getElementById(cod).style.display = 'block'
|
334 |
document.getElementById(cod).style.display = "block";
|
| 348 |
}
|
335 |
}
|
| 349 |
}
|
336 |
}
|
| 350 |
if(data.on_time_guarantee == true){
|
337 |
if (data.on_time_guarantee == true) {
|
| 351 |
var otg = items[j].id+'otg';
|
338 |
var otg = items[j].id + "otg";
|
| 352 |
if(document.getElementById(otg).style.display == 'none'){
|
339 |
if (document.getElementById(otg).style.display == "none") {
|
| 353 |
document.getElementById(otg).style.display = 'block'
|
340 |
document.getElementById(otg).style.display = "block";
|
| 354 |
}
|
341 |
}
|
| 355 |
}
|
342 |
}
|
| 356 |
|
- |
|
| 357 |
}
|
- |
|
| 358 |
else{
|
343 |
} else {
|
| 359 |
var del = items[j].id+'delivery';
|
344 |
var del = items[j].id + "delivery";
|
| 360 |
document.getElementById(del).style.display = 'none';
|
345 |
document.getElementById(del).style.display = "none";
|
| 361 |
var cod = items[j].id+'cod';
|
346 |
var cod = items[j].id + "cod";
|
| 362 |
document.getElementById(cod).style.display = 'none';
|
347 |
document.getElementById(cod).style.display = "none";
|
| 363 |
var otg = items[j].id+'otg';
|
348 |
var otg = items[j].id + "otg";
|
| 364 |
document.getElementById(otg).style.display = 'none';
|
349 |
document.getElementById(otg).style.display = "none";
|
| 365 |
var service = items[j].id+'service';
|
350 |
var service = items[j].id + "service";
|
| 366 |
document.getElementById(service).style.display = 'block';
|
351 |
document.getElementById(service).style.display = "block";
|
| 367 |
document.getElementById(service).innerHTML = 'Location is not serviceable';
|
352 |
document.getElementById(service).innerHTML = "Location is not serviceable";
|
| 368 |
locationServicable = false;
|
353 |
locationServicable = false;
|
| 369 |
itemsNotServicable++;
|
354 |
itemsNotServicable++;
|
| 370 |
}
|
355 |
}
|
| 371 |
j--;
|
356 |
j--;
|
| 372 |
}
|
357 |
}
|
| 373 |
});
|
358 |
});
|
| 374 |
}
|
359 |
}
|
| 375 |
}else{
|
360 |
} else {
|
| 376 |
document.getElementById('error').style.display = 'block';
|
361 |
document.getElementById("error").style.display = "block";
|
| 377 |
document.getElementById('error').innerHTML = 'Invalid pincode!'
|
362 |
document.getElementById("error").innerHTML = "Invalid pincode!";
|
| 378 |
}
|
363 |
}
|
| 379 |
}
|
364 |
}
|
| 380 |
|
365 |
|
| 381 |
function shomoreredirect(){
|
366 |
function shomoreredirect() {
|
| 382 |
window.location.href = base_url;
|
367 |
window.location.href = base_url;
|
| 383 |
}
|
368 |
}
|
| 384 |
|
369 |
|