Subversion Repositories SmartDukaan

Rev

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

Rev 11888 Rev 12524
Line 54... Line 54...
54
	}
54
	}
55
        //document.getElementById("addCoupon").style.display = "none";
55
        //document.getElementById("addCoupon").style.display = "none";
56
        document.getElementById("removeCoupon").style.display = "block";
56
        document.getElementById("removeCoupon").style.display = "block";
57
        if (data.couponCode.length > 0) {
57
        if (data.couponCode.length > 0) {
58
          document.getElementById("removeCoupon").innerHTML = "Remove Coupon: " + data.couponCode;
58
          document.getElementById("removeCoupon").innerHTML = "Remove Coupon: " + data.couponCode;
59
          if ( typeof _gaq != "undefined" && _gaq != null) {
59
          /*if ( typeof _gaq != "undefined" && _gaq != null) {
60
            _gaq.push(["_trackEvent", "COUPON", "Coupon Applied", data.couponCode]);
60
            _gaq.push(["_trackEvent", "COUPON", "Coupon Applied", data.couponCode]);
61
          }
61
          }*/
-
 
62
	ga('send', 'event', 'Coupon', 'Coupon Applied',data.couponCode);
62
	      }else{
63
	      }else{
63
          document.getElementById("removeCoupon").innerHTML = "Remove Coupon";
64
          document.getElementById("removeCoupon").innerHTML = "Remove Coupon";
64
        }
65
        }
65
        document.getElementById("discount").style.display = "block";
66
        document.getElementById("discount").style.display = "block";
66
        var discount = parseInt(data.totalPrice) - parseInt(data.discountedPrice);
67
        var discount = parseInt(data.totalPrice) - parseInt(data.discountedPrice);
Line 76... Line 77...
76
}
77
}
77
 
78
 
78
function clearcoupon(code) {
79
function clearcoupon(code) {
79
  var url = base_url + "cart/couponClear/" + code;
80
  var url = base_url + "cart/couponClear/" + code;
80
  microAjax(url, function(res) {
81
  microAjax(url, function(res) {
81
    if ( typeof _gaq != "undefined" && _gaq != null) {
82
    /*if ( typeof _gaq != "undefined" && _gaq != null) {
82
      _gaq.push(["_trackEvent", "COUPON", "Coupon Removed", document.getElementById("couponcode").value]);
83
      _gaq.push(["_trackEvent", "COUPON", "Coupon Removed", document.getElementById("couponcode").value]);
83
    }
84
    }*/
-
 
85
	ga('send', 'event', 'Coupon', 'Coupon Removed',document.getElementById("couponcode").value);
84
    var data = JSON.parse(res);
86
    var data = JSON.parse(res);
85
    var message = data.message;
87
    var message = data.message;
86
    var total = data.totalPrice;
88
    var total = data.totalPrice;
87
    document.getElementById("addCoupon").style.display = "block";
89
    document.getElementById("addCoupon").style.display = "block";
88
    document.getElementById("removeCoupon").style.display = "none";
90
    document.getElementById("removeCoupon").style.display = "none";
Line 137... Line 139...
137
    theft = parseInt(theft);
139
    theft = parseInt(theft);
138
    var total = document.getElementById("total").innerHTML;
140
    var total = document.getElementById("total").innerHTML;
139
    total = parseInt(total);
141
    total = parseInt(total);
140
    if (insure == true) {
142
    if (insure == true) {
141
      insuredItems.push(itemId);
143
      insuredItems.push(itemId);
142
      if ( typeof _gaq != "undefined" && _gaq != null) {
144
      /*if ( typeof _gaq != "undefined" && _gaq != null) {
143
        _gaq.push(["_trackEvent", "insurance", "Want Insurance", itemId]);
145
        _gaq.push(["_trackEvent", "insurance", "Want Insurance", itemId]);
144
      }
146
      }*/
-
 
147
	ga('send', 'event', 'Insurance', 'Want Insurance',itemId);
145
      if (document.getElementById("discountPrice").style.display == "block") {
148
      if (document.getElementById("discountPrice").style.display == "block") {
146
        var discountPrice = document.getElementById("discountedPrice").innerHTML;
149
        var discountPrice = document.getElementById("discountedPrice").innerHTML;
147
        discountPrice = parseInt(discountPrice);
150
        discountPrice = parseInt(discountPrice);
148
        document.getElementById("discountedPrice").innerHTML = discountPrice + theft;
151
        document.getElementById("discountedPrice").innerHTML = discountPrice + theft;
149
      } else {
152
      } else {
Line 197... Line 200...
197
    } else {
200
    } else {
198
      document.getElementById(tc).style.display = "block";
201
      document.getElementById(tc).style.display = "block";
199
    }
202
    }
200
  } else {
203
  } else {
201
    if (insure == true && tncChkd == true) {
204
    if (insure == true && tncChkd == true) {
202
      if ( typeof _gaq != "undefined" && _gaq != null) {
205
      /*if ( typeof _gaq != "undefined" && _gaq != null) {
203
        _gaq.push(["_trackEvent", "Insurance", "Agreed to Terms", itemId]);
206
        _gaq.push(["_trackEvent", "Insurance", "Agreed to Terms", itemId]);
204
      }
207
      }*/
-
 
208
	ga('send', 'event', 'Insurance', 'Agreed to Terms',itemId);
205
      var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
209
      var url = base_url + "cart/insure/" + itemId + "/" + insure + "/1";
206
      microAjax(url, function(res) {
210
      microAjax(url, function(res) {
207
        var data = JSON.parse(res);
211
        var data = JSON.parse(res);
208
        data = data.status;
212
        data = data.status;
209
        if (data == true) {
213
        if (data == true) {
Line 266... Line 270...
266
  for (var i = 0; i < chx.length; i++) {
270
  for (var i = 0; i < chx.length; i++) {
267
    if (chx[i].type == "checkbox" && chx[i].checked) {
271
    if (chx[i].type == "checkbox" && chx[i].checked) {
268
      var id = chx[i].getAttribute("data-value");
272
      var id = chx[i].getAttribute("data-value");
269
      var tnc = id + "tnc";
273
      var tnc = id + "tnc";
270
      if (document.getElementById(tnc).checked == false) {
274
      if (document.getElementById(tnc).checked == false) {
271
        if ( typeof _gaq != "undefined" && _gaq != null) {
275
        /*if ( typeof _gaq != "undefined" && _gaq != null) {
272
          _gaq.push(["_trackEvent", "Insurance", "Alert for tnc"]);
276
          _gaq.push(["_trackEvent", "Insurance", "Alert for tnc"]);
273
        }
277
        }*/
-
 
278
	ga('send', 'event', 'Insurance', 'Alert for tnc');
274
        document.getElementById("error").style.display = "block";
279
        document.getElementById("error").style.display = "block";
275
        document.getElementById("error").innerHTML = "Please agree to the terms and conditions to get insurance";
280
        document.getElementById("error").innerHTML = "Please agree to the terms and conditions to get insurance";
276
        window.scrollTo(0, 0);
281
        window.scrollTo(0, 0);
277
        return false;
282
        return false;
278
        break;
283
        break;
279
      }
284
      }
280
    }
285
    }
281
  }
286
  }
282
  if (locationServicable == false) {
287
  if (locationServicable == false) {
283
    var pincode = document.getElementById("pincode").value;
288
    var pincode = document.getElementById("pincode").value;
284
    if ( typeof _gaq != "undefined" && _gaq != null) {
289
    /*if ( typeof _gaq != "undefined" && _gaq != null) {
285
      _gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
290
      _gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
286
    }
291
    }*/
-
 
292
	ga('send', 'event', 'Cart', 'Location not serviceable',pincode);
287
    document.getElementById("error").style.display = "block";
293
    document.getElementById("error").style.display = "block";
288
    if (itemsNotServicable == items.length) {
294
    if (itemsNotServicable == items.length) {
289
      document.getElementById("error").innerHTML = "Location not serviceable. Please try a different pincode";
295
      document.getElementById("error").innerHTML = "Location not serviceable. Please try a different pincode";
290
    } else {
296
    } else {
291
      if (itemsNotServicable != items.length) {
297
      if (itemsNotServicable != items.length) {
Line 295... Line 301...
295
    window.scrollTo(0, 0);
301
    window.scrollTo(0, 0);
296
    return false;
302
    return false;
297
  }
303
  }
298
  if ((notServiceableLocation != undefined) && (notServiceableLocation != 0)) {
304
  if ((notServiceableLocation != undefined) && (notServiceableLocation != 0)) {
299
    var pincode = document.getElementById("pincode").value;
305
    var pincode = document.getElementById("pincode").value;
300
    if ( typeof _gaq != "undefined" && _gaq != null) {
306
    /*if ( typeof _gaq != "undefined" && _gaq != null) {
301
      _gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
307
      _gaq.push(["_trackEvent", "Cart", "Location not serviceable", pincode]);
302
    }
308
    }*/
-
 
309
	ga('send', 'event', 'Cart', 'Location not serviceable',pincode);
303
    document.getElementById("error").style.display = "block";
310
    document.getElementById("error").style.display = "block";
304
    if (notServiceableLocation == items.length) {
311
    if (notServiceableLocation == items.length) {
305
      document.getElementById("error").innerHTML = "Location not serviceable. Please try a different pincode";
312
      document.getElementById("error").innerHTML = "Location not serviceable. Please try a different pincode";
306
    } else {
313
    } else {
307
      if (notServiceableLocation != items.length) {
314
      if (notServiceableLocation != items.length) {