1$(document).ready(function () { 2 LeadReview1stTime(); 3 GetCartCount(); 4 //GetCart(); 5 //BindAllCoupons(); 6 $(document.body).on("click", ".chkRec", function () { 7 var name = $("#txtNameC").val(); 8 var mob = $("#txtCnoC").val(); 9 $("#txtRecName").val(name); 10 $("#txtRecNo").val(mob); 11 }); 12 13 $("#btnApply").click(function () { 14 var name = $("#txtNameC").val(); var email = $("#txtEmailC").val(); var mob = $("#txtCnoC").val(); var flat = $("#txtFlat").val(); var locality = $("#txtLocality").val(); var loc = $("#txtLoc").val(); var city = $("#txtCity").val(); var pin = $("#txtPin").val(); var recnm = $("#txtRecName").val(); var recno = $("#txtRecNo").val(); var cpn = $(".coupns").text(); if (name !== "" && email !== "" && mob !== "" && flat !== "" && locality !== "" && pin !== "" && recnm !== "" && recno !== "") { 15 if (cpn === "") { 16 $("#cpnModal").modal("show"); var tot = $(".priceval").text(); var parameter = { "tot": tot }; if (tot !== "") { 17 $.ajax({
18 type: "POST", url: "/Checkout.aspx/GetCoupons", data: JSON.stringify(parameter), contentType: 'application/json; charset=utf-8', success: function (res) { 19 var cp = ""; if (res.d.toString().split('|')[0] === "Success") { cp = res.d.toString().split('|')[1]; $(".coup").empty(); $(".coup").append("<tr><th>Coupon Code</th><th></th><th>Coupon Value</th></tr>" + cp); } 20 else if (res.d.toString().split('|')[0] === "Fail") { cp = res.d.toString().split('|')[1]; $(".coup").empty(); $(".coup").append(cp); } 21 } 22 }); 23 } 24 else { $("#spcou").empty(); $("#spcou").append("Please Enter Coupon Code"); } 25 } 26 else { $("#cpnModal").modal("hide"); $(".coup").empty(); $(".coup").html("<p>Coupon Code Already Applied.</p>"); } 27 } 28 else { $("#spcou").empty(); $("#spcou").append("Please Enter All The Mandatory Fields..."); } 29 }); 30 31 $(document.body).on("click", ".apply", function () { 32 $("#cpnModal").modal("hide"); var coupon = $(this).attr('id'); var parameter = { "coupon": coupon }; if (coupon !== "") { 33 $.ajax({
34 type: "POST", url: "/Checkout.aspx/ApplyCoupon", data: JSON.stringify(parameter), contentType: 'application/json; charset=utf-8', success: function (res) { 35 if (res.d.toString().split('|')[0] === "Success") { var cp = res.d.toString().split('|')[1]; $(".coupns").empty(); $(".coupns").text(res.d.toString().split('|')[2]); $("#spcou").empty(); $("#spcou").append("Coupon Code Applied Successfully...."); var tot = $(".totval").text(); var price = $(".priceval").text(); var ship = $(".lblshipval").text(); cp = (parseFloat(price) / parseFloat(100)) * (parseFloat(cp)); var tt = parseFloat(tot) - parseFloat(cp); var pp = parseFloat(price) - parseFloat(cp); $(".totval").text(tt); $(".priceval").text(pp.toFixed(2)); $("#spDis").append(cp.toFixed(2)); $("#spDis1").append(cp.toFixed(2)); $("#lblCValue").val(cp.toFixed(2)); } 36 if (res.d.toString().split('|')[1] === "Exists") { $("#spcou").empty(); $("#spcou").append("Coupon Code Doesn't Exists...."); } 37 if (res.d.toString().split('|')[1] === "More") { $("#spcou").empty(); $("#spcou").append("Sorry You Cann't Use This Coupon Code...."); } 38 if (res.d.toString().split('|')[1] === "Expire") { $("#spcou").empty(); $("#spcou").append("Sorry Coupon Code Expired...."); } 39 } 40 }); 41 } 42 else { $("#spcou").empty(); $("#spcou").append("Please Select Coupon Code"); } 43 }); 44 45 $("#myDiv .close-sec a").click(function () { 46 if ($('.top-banner-sec').css('display') == 'none') { 47 $(".signin-5").css("cssText", "top: 85px !important;"); 48 //$(".signin-5").css("top", "85px !important"); 49 } 50 else 51 $(".signin-5").css("top", "110px"); 52 }); 53 54 $(document.body).on("click", ".chksave", function () { 55 var name = $("#txtNameC").val(); var email = $("#txtEmailC").val(); var mob = $("#txtCnoC").val(); var flat = $("#txtFlat").val(); var locality = $("#txtLocality").val(); var loc = $("#txtLoc").val(); var city = $("#txtCity").val(); var pin = $("#txtPin").val(); var recnm = $("#txtRecName").val(); var recno = $("#txtRecNo").val(); if (name !== "" && email !== "" && mob !== "" && flat !== "" && locality !== "" && pin !== "" && recnm !== "" && recno !== "") { 56 if (ValidateEmail(email)) { $("#divchk2").css("display", "none"); } 57 else { $("#spem").empty(); $("#spem").append("Invalid Email ID"); } 58 } 59 else { 60 if (name === "") { $("#spnm").empty(); $("#spnm").append("Field Cann't Be Blank!"); } 61 if (email === "") { $("#spem").empty(); $("#spem").append("Field Cann't Be Blank!"); } 62 if (mob === "") { $("#spmb").empty(); $("#spmb").append("Field Cann't Be Blank!"); } 63 if (flat === "") { $("#spflat").empty(); $("#spflat").append("Field Cann't Be Blank!"); } 64 if (locality === "") { $("#splcty").empty(); $("#splcty").append("Field Cann't Be Blank!"); } 65 if (pin === "") { $("#sppin").empty(); $("#sppin").append("Field Cann't Be Blank!"); } 66 if (recnm === "") { $("#sprcnm").empty(); $("#sprcnm").append("Field Cann't Be Blank!"); } 67 if (recno === "") { $("#sprcno").empty(); $("#sprcno").append("Field Cann't Be Blank!"); } 68 } 69 }); 70 71 $("#btnSave").click(function () { 72 var name = $("#txtNameC").val(); var email = $("#txtEmailC").val(); var mob = $("#txtCnoC").val(); var flat = $("#txtFlat").val(); var locality = $("#txtLocality").val(); var loc = $("#txtLoc").val(); var city = $("#txtCity").val(); var pin = $("#txtPin").val(); var recnm = $("#txtRecName").val(); var recno = $("#txtRecNo").val(); var coupon = $(".coupns").text(); var cvalue = $("#lblCValue").val(); var ship = $(".lblshipval").text(); $("#spnm").empty(); $("#spem").empty(); $("#spmb").empty(); $("#spflat").empty(); $("#splcty").empty(); $("#sppin").empty(); $("#sprcnm").empty(); $("#sprcno").empty(); var parameter = { "name": name, "email": email, "mob": mob, "flat": flat, "locality": locality, "loc": loc, "city": city, "pin": pin, "recnm": recnm, "recno": recno, "coupon": coupon, "cvalue": cvalue, "ship": ship }; if (name !== "" && email !== "" && mob !== "" && flat !== "" && locality !== "" && pin !== "" && recnm !== "" && recno !== "") { 73 if (ValidateEmail(email)) { $.ajax({ type: "POST", url: "/Checkout.aspx/ProceedToCheckout", data: JSON.stringify(parameter), contentType: 'application/json; charset=utf-8', success: function (res) { if (res.d.toString().split('|')[0] === "Success") { window.location.href = "pb-cart.aspx?id=" + res.d.toString().split('|')[1]; } } }); } 74 else { $("#spem").empty(); $("#spem").append("Invalid Email ID"); } 75 } 76 else { 77 if (name === "") { $("#spnm").empty(); $("#spnm").append("Field Cann't Be Blank!"); } 78 if (email === "") { $("#spem").empty(); $("#spem").append("Field Cann't Be Blank!"); } 79 if (mob === "") { $("#spmb").empty(); $("#spmb").append("Field Cann't Be Blank!"); } 80 if (flat === "") { $("#spflat").empty(); $("#spflat").append("Field Cann't Be Blank!"); } 81 if (locality === "") { $("#splcty").empty(); $("#splcty").append("Field Cann't Be Blank!"); } 82 if (pin === "") { $("#sppin").empty(); $("#sppin").append("Field Cann't Be Blank!"); } 83 if (recnm === "") { $("#sprcnm").empty(); $("#sprcnm").append("Field Cann't Be Blank!"); } 84 if (recno === "") { $("#sprcno").empty(); $("#sprcno").append("Field Cann't Be Blank!"); } 85 } 86 });
87 88 $(document.body).on("click", ".cartitemnew, .cartitem", function () { 89 var id = $(this).attr('id'); 90 var pid = $(this).attr('pid'); 91 var txt = $(this).attr('data-type'); 92 var qty = "1"; 93 if (!isNaN(qty)) { 94 if (parseInt(qty) > 0) 95 if (txt === "Buy") { BuyNowCheckout(id, pid, qty); } else if (txt === "Add") { ItemCartNew(id, pid, qty); } 96 } 97 98 }); 99 100 $(document.body).on("click", ".addcartitem", function () { 101 var id = $(this).attr('id'); var pid = $(this).attr('pid'); 102 var qty = $(".qty").val(); ItemCart(id, pid, qty); return false; 103 }); 104 105 $(document.body).on("click", ".paddcart", function () { 106 var id = $(this).attr('id'); 107 var pid = $(this).attr('pid'); 108 var qty = $(".qty").val(); 109 var txt = $(this).attr('data-type'); 110 if (txt === "Buy") { BuyNowCheckout(id, pid, qty); return false; } else if (txt === "Add") { ItemCartNew(id, pid, qty); return false; } 111 //ItemCart(id, pid, qty); return false; 112 }); 113 114 $(document.body).on("click", ".btnCheck", function () { 115 $(".chkerror").empty(); 116 var val = $("#pincode").val(); 117 if (val === "" || val === undefined) { 118 $(".chkerror").empty(); 119 $(".chkerror").append("Field can't be empty"); 120 $("#lblStatus").empty(); 121 $("#lblStatus").append("Enter pincode to check delivery availability."); 122 } 123 else { 124 $(".chkerror").empty(); 125 $.ajax({
126 type: "POST", 127 url: "/product-detail.aspx/PincodeValidation", 128 data: "{pincode:'" + val + "'}", 129 contentType: 'application/json; charset=utf-8', 130 success: function (res) { 131 if (res.d === "Success") { 132 $("#lblStatus").removeAttr("style"); 133 $("#lblStatus").attr("style", "color:green !important;"); 134 $("#lblStatus").empty(); 135 $("#lblStatus").append("Delivery is available for this pincode."); 136 } 137 else if (res.d === "N") { 138 $("#lblStatus").removeAttr("style"); 139 $("#lblStatus").attr("style", "color:red !important;"); 140 $("#lblStatus").empty(); 141 $("#lblStatus").append("Delivery is not available for this pincode."); 142 } 143 else { 144 $("#lblStatus").empty(); 145 $("#lblStatus").removeAttr("style"); 146 $("#lblStatus").attr("style", "color:red !important;"); $("#lblStatus").append("There is some problem now. Please try after sometime."); 147 } 148 }, 149 error: function (errr) { 150 $("#lblStatus").empty(); 151 $("#lblStatus").removeAttr("style"); 152 $("#lblStatus").attr("style", "color:red !important;"); $("#lblStatus").append("There is some problem now. Please try after sometime."); 153 } 154 }); 155 } 156 }); 157 158 $(document.body).on("click", ".pminus", function () { 159 var id = $(this).attr('id').split('_')[1]; var qty = $("#PQ_" + id).val(); var noof = $(".qty").val(); if (!isNaN(qty)) { 160 if (parseInt(qty) > 1) { $("#PQ_" + id).val(parseInt(qty) - 1); } 161 return false; 162 } 163 }); 164 165 $(".st1, .st2, .st3, .st4, .st5").click(function () { 166 var val = $(this).attr("data-val"); 167 $(".rating-star .fa-star").css("color", "black"); 168 for (var i = 0; i < parseInt(val); i++) 169 $(".st" + (i + 1)).css("color", "#ffc300"); 170 $(".txtRating").val(val); 171 }); 172 173 $(".st1, .st2, .st3, .st4, .st5").hover( 174 function () { 175 var val = $(this).attr("data-val"); 176 $(".rating-star .fa-star").css("color", "black"); 177 for (var i = 0; i < parseInt(val); i++) 178 $(".st" + (i + 1)).css("color", "#ffc300"); 179 }, 180 function () { 181 $(".rating-star .fa-star").css("color", "black"); 182 var val = $(".txtRating").val(); 183 for (var i = 0; i < parseInt(val); i++) 184 $(".st" + (i + 1)).css("color", "#ffc300"); 185 } 186 ); 187 188 $("#resotplog").click(function () { 189 var mob = $("input[id*='txtCnoR']").val(); var parameter = { "mobile": mob }; if (mob !== "") { 190 $.ajax({
191 type: "POST", url: "/Backend.asmx/SendOTP", data: JSON.stringify(parameter), contentType: 'application/json; charset=utf-8', success: function (res) { 192 if (res.d === "Success") { $("#spotpl").empty(); $("#spotpl").append("OTP Has Resend To Your Number Please check and enter."); } 193 else { $("#spotpl").empty(); $("#spotpl").append("Sorry There Is Some Problem, Please Try after sometime."); } 194 } 195 }); 196 } 197 else { $("#spotpl").empty(); $("#spotpl").append("Please Enter Mobile No"); } 198 }); 199 200 $("#veriftotp").click(function () { 201 var otp = $("#txtotp").val(); var id = $("#txtguid").val(); var parameter = { "otp": otp, "id": id }; if (otp !== "") { 202 $.ajax({ 203 type: "POST", url: "/Backend.asmx/VerifyOTP", data: JSON.stringify(parameter), contentType: 'application/json; charset=utf-8', success: function (res) { 204 if (res.d.toString() === "Success") { $("#verifymsg").css("display", "none"); $("#msg").css("display", "block"); } 205 else { $("#spotpl").append("Invalid OTP"); } 206 } 207 }); 208 } 209 else { $("#spotpl").empty(); $("#spotpl").append("Please Enter OTP"); } 210 }); 211 212 $("#ver").click(function () { 213 var id = $("#txtguid").val(); var parameter = { "id": id }; 214 $.ajax({
215 type: "POST", url: "/Backend.asmx/VerifyStatus", data: JSON.stringify(parameter), contentType: 'application/json; charset=utf-8', success: function (res) { 216 if (res.d === "Success") { $("#errmsg").css("display", "none"); $("#msg").css("display", "block"); } 217 else { $("#errmsg").CSS("display", "block"); } 218 } 219 }); 220 }); 221 222 $(document.body).on("click", ".pplus", function () { 223 var id = $(this).attr('id').split('_')[1]; var qty = $("#PQ_" + id).val(); var noof = $(".qty").val(); if (!isNaN(qty)) { $("#PQ_" + id).val(parseInt(qty) + 1); } 224 return false; 225 }); 226 227 $(document.body).on('click', '.deletecart', function () { 228 var x = confirm("Are you sure to remove packages from cart"); 229 if (x === true) { 230 var id = $(this).attr("id").split('_')[1]; 231 var parameter = { "id": id }; 232 RemoveCartGtag(id); 233 $.ajax({ 234 type: 'POST', 235 url: "/Backend.asmx/RemoveCart", 236 data: JSON.stringify(parameter), 237 contentType: 'application/json; charset=utf-8', 238 dataType: "json", 239 async: false, 240 success: function (res) { 241 GetCartCount(); 242 CartView(res.d); 243 NewCheckCartView(res.d); 244 } 245 }); 246 } 247 }); 248 249 250 $(".qtycart").change(function () { 251 var id = $(this).attr("id"); 252 var qty = $("#qty").val(); 253 var parameter = { "Id": id, "quantity": qty }; 254 $.ajax({
255 type: 'POST', 256 url: "/Backend.asmx/UpdateCart", 257 data: JSON.stringify(parameter), 258 contentType: 'application/json; charset=utf-8', 259 dataType: "json", 260 async: false, 261 success: function (res) { 262 window.location.reload(); 263 } 264 }); 265 }); 266 $(document.body).on("click", ".cminus", function () { 267 var id = $(this).attr('id').split('_')[1]; 268 var qty = $("#qty_" + id).val(); 269 if (!isNaN(qty)) { 270 if (parseInt(qty) > 1) { 271 $("#qty_" + id).val(parseInt(qty) - 1); 272 } 273 qty = $("#qty_" + id).val(); 274 var parameter = { "id": id, "qty": qty }; 275 $.ajax({ 276 type: 'POST', 277 url: "/Backend.asmx/UpdateCart", 278 data: JSON.stringify(parameter), 279 contentType: 'application/json; charset=utf-8', 280 dataType: "json", 281 async: false, 282 success: function (res) { 283 var product_ = res.d; 284 if (product_.length > 0) { 285 286 for (let i = 0; i < product_.length; i++) { 287 if (product_[i].Id == id) { 288 var itemArray = { 289 item_id: 'SKU_' + product_[i].ProductId, 290 item_name: product_[0].ProductName, 291 affiliation: 'Google Merchandise Store', 292 discount: (parseFloat(product_[i].ActualPrice) - parseFloat(product_[i].DiscountPrice)), 293 index: 0, 294 price: parseFloat(product_[i].DiscountPrice), 295 quantity: 1 296 }; 297 298 299 gtag("event", "remove_from_cart", { 300 currency: "INR", 301 value: (parseFloat(product_[i].DiscountPrice)), 302 items: [itemArray] 303 }); 304 } 305 } 306 } 307 GetCartCount(); 308 CartView(res.d); 309 NewCheckCartView(res.d); 310 } 311 }); 312 } 313 return false; 314 }); 315 $(document.body).on("click", ".cplus", function () { 316 var id = $(this).attr('id').split('_')[1]; 317 var qty = $("#qty_" + id).val(); 318 if (!isNaN(qty)) { 319 $("#qty_" + id).val(parseInt(qty) + 1); 320 } 321 qty = $("#qty_" + id).val(); 322 var parameter = { "id": id, "qty": qty }; 323 $.ajax({
324 type: 'POST', 325 url: "/Backend.asmx/UpdateCart", 326 data: JSON.stringify(parameter), 327 contentType: 'application/json; charset=utf-8', 328 dataType: "json", 329 async: false, 330 success: function (res) { 331 332 333 334 var product_ = res.d; 335 if (product_.length > 0) { 336 337 for (let i = 0; i < product_.length; i++) { 338 if (product_[i].Id == id) { 339 var itemArray = { 340 item_id: 'SKU_' + product_[i].ProductId, 341 item_name: product_[0].ProductName, 342 affiliation: 'Google Merchandise Store', 343 discount: (parseFloat(product_[i].ActualPrice) - parseFloat(product_[i].DiscountPrice)), 344 index: 0, 345 price: parseFloat(product_[i].DiscountPrice), 346 quantity: parseFloat(product_[i].Qty) 347 }; 348 349 350 gtag("event", "add_to_cart", { 351 currency: "INR", 352 value: (parseFloat(product_[i].DiscountPrice) * parseFloat(product_[i].Qty)), 353 items: [itemArray] 354 }); 355 } 356 } 357 } 358 359 GetCartCount(); 360 CartView(res.d); 361 NewCheckCartView(res.d); 362 } 363 }); return false; 364 }); 365 366 //$(document.body).on("click", ".dpbuynow", function () { 367 // var id = $(this).attr('id'); 368 // var pid = $(this).attr('pid'); 369 // var pid = $(this).attr('data-type'); 370 // var qty = $(".qty").val(); 371 // BuyNowCheckout(id, pid, qty); return false; 372 //}); 373 //$(document.body).on("click", ".buynowcheck", function () { 374 // var id = $(this).attr('id'); 375 // var pid = $(this).attr('pid'); 376 // var qty = "1"; 377 // if (!isNaN(qty)) { 378 // if (parseInt(qty) > 0) 379 // BuyNowCheckout(id, pid, qty); 380 // } 381 382 //}); 383 384 //$(document.body).on("click", ".cartitem", function () { 385 // var id = $(this).attr('id'); 386 // var qty = "1"; 387 // if (!isNaN(qty)) { 388 // if (parseInt(qty) > 0) 389 // ItemCartNew(id, qty); 390 // } 391 392 // return false; 393 //}); 394 //$(".st1").click(function () { 395 // $(".fa-star").css("color", "black"); 396 // $(".st1").css("color", "#ffc300"); 397 // $(".txtRating").val("1"); 398 399 //}); 400 //$(".st2").click(function () { 401 // $(".fa-star").css("color", "black"); 402 // $(".st1, .st2").css("color", "#ffc300"); 403 // $(".txtRating").val("2"); 404 //}); 405 //$(".st3").click(function () { 406 // $(".fa-star").css("color", "black") 407 // $(".st1, .st2, .st3").css("color", "#ffc300"); 408 // $(".txtRating").val("3"); 409 //}); 410 //$(".st4").click(function () { 411 // $(".fa-star").css("color", "black"); 412 // $(".st1, .st2, .st3, .st4").css("color", "#ffc300"); 413 // $(".txtRating").val("4"); 414 //}); 415 //$(".st1, .st2, .st3, .st4, .st5").mo(function () { 416 // //$(".productRating .fa-star").css("color", "black"); 417 // //$(".st" + $(".txtRating").val()).css("color", "#ffc300"); 418 // //$(".txtRating").val("1"); 419 // RatingOut(); 420 //}); 421 //$(".st2").hover(function () { 422 // $(".fa-star").css("color", "black"); 423 // $(".st1, .st2").css("color", "#ffc300"); 424 // $(".txtRating").val("2"); 425 //}); 426 //$(".st3").hover(function () { 427 // $(".fa-star").css("color", "black") 428 // $(".st1, .st2, .st3").css("color", "#ffc300"); 429 // $(".txtRating").val("3"); 430 //}); 431 //$(".st4").hover(function () { 432 // $(".fa-star").css("color", "black"); 433 // $(".st1, .st2, .st3, .st4").css("color", "#ffc300"); 434 // $(".txtRating").val("4"); 435 //}); 436 //$(".st5").hover(function () { 437 // $(".fa-star").css("color", "black"); 438 // $(".st1, .st2, .st3, .st4, .st5").css("color", "#ffc300"); 439 // $(".txtRating").val("5"); 440 //}); 441 //-------------------New coupon design binding here------> 442 443 444 $(document.body).on('click', ".Applycpnoffer", function () { 445 var coupon = $(this).attr("data-value") 446 $(".txtCoupon").val(coupon); 447 $(".cerror").empty(); 448 $(".resultdata").empty(); 449 if (coupon != "" || coupon !== undefined) { 450 $.ajax({
451 type: 'POST', 452 url: "/Backend.asmx/ValidateCoupon", 453 data: "{coupon: '" + coupon + "'}", 454 contentType: 'application/json; charset=utf-8', 455 dataType: "json", 456 async: false, 457 success: function (res) { 458 459 var result = res.d; 460 if (result != null) { 461 if (result.CouponStatus == "Valid") { 462 $(".cerror").html(""); 463 $(".resultdata").html("Coupon Applied Successfully"); 464 $(".noCoupon").addClass("d-none"); 465 $(".appliedCoupon").removeClass("d-none"); 466 $(".totalamountsave").html("You are saving â¹" + result.TotalSavings + " on this order"); 467 $(".Appliedcpndata").html(" Code " + coupon + " applied!"); 468 $(".discountcpn").html("<h5 class='headsec'>Coupon Discount</h5> <h5 class='detailsec'><span class='text-green '> -" + result.Discount + "</span></h5>"); 469 } 470 else { 471 $(".noCoupon").removeClass("d-none"); 472 $(".appliedCoupon").addClass("d-none"); 473 $(".cerror").html(result.CouponStatus); 474 $(".resultdata").html(""); 475 $(".Appliedcpndata").html(""); 476 $(".discountcpn").html(""); 477 } 478 $(".totalamountsave").html("You are saving â¹" + result.TotalSavings + " on this order"); 479 // $(".Ordertotaldata").html("â¹" + result.SubTotal); 480 $(".Ordertotaldata").html("<del>â¹" + result.ActSubTotal + "</del> <span>â¹" + result.SubTotal + "</span>"); 481 482 $(".shippingTotal").html(result.Shipping == "0" || result.Shipping == "" ? "<span class='text-dec'>â¹100</span> <span class='text-green'>Free</span>" : "<span >â¹100</span>"); 483 $(".gtotal").html("â¹" + result.FinalAmount); 484 } 485 486 //if (res.d.toString() === "Couponvalid") { 487 488 // $(".totalamountsave").empty(); 489 // $(".discountcpn").empty(); 490 // $(".resultdata").empty(); 491 // $(".cerror").empty(); 492 // $(".gtotal").append("â¹" + disccpn); 493 // $(".txtCoupon").parent().find(".resultdata").html("Coupon added successfully"); 494 // $(".totalamountsave").append("<p>You are saving â¹" + saveprice + "on this order</p>"); 495 // $(".discountcpn").append("<h5 class='headsec'>Coupon Discount</h5> <h5 class='detailsec'><span class='text-green getcdata' d-ccode=" + cpnselected + " d-ctype=" + CCType + " d-cvalue=" + CValue + "> -" + CValue + "</span></h5>"); 496 // $(".appliedvalcpn").removeClass("d-none"); 497 // $(".Appliedcpndata").text("" + cpnselected + " applied!"); 498 499 //} 500 //else if (res.d.toString() === "ProCouponvalid") { 501 // $(".gtotal").empty(); 502 // $(".totalamountsave").empty(); 503 // $(".discountcpn").empty(); 504 // $(".resultdata").empty(); 505 // $(".cerror").empty(); 506 // $(".gtotal").append("â¹" + disccpn); 507 // $(".txtCoupon").parent().find(".resultdata").html("Coupon added successfully"); 508 // $(".totalamountsave").append("<p>You are saving â¹" + saveprice + "on this order</p>"); 509 // $(".discountcpn").append("<h5 class='headsec'>Coupon Discount</h5> <h5 class='detailsec'><span class='text-green getcdata' d-ccode=" + cpnselected + " d-ctype=" + CCType + " d-cvalue=" + CValue + "> -" + CValue + "</span></h5>"); 510 // $(".appliedvalcpn").removeClass("d-none"); 511 // $(".Appliedcpndata").text("" + cpnselected + " applied!"); 512 //} 513 //else { 514 // $(".txtCoupon").parent().find(".resultdata").html(""); 515 // $(".discountcpn").empty(); 516 // $(".txtCoupon").parent().find(".cerror").html("Invalid coupon code."); 517 // $(".appliedvalcpn").addClass("d-none"); 518 //} 519 //if (res.d.toString() === "couponval") { 520 // $(".txtCoupon").parent().find(".cerror").html("Invalid coupon code."); 521 // $(".appliedvalcpn").addClass("d-none"); 522 //} 523 524 }, 525 error: function (data) { 526 alert("There is some problem now. Please try after sometime."); 527 } 528 }); 529 } 530 else { 531 $(".cerror").append(""); 532 } 533 534 535 });
536 537 $(document.body).on('click', "#removeOption", function () { 538 if ($(".txtCoupon").val() != "") { 539 $.ajax({ 540 type: 'POST', 541 url: "/Backend.asmx/RemoveCoupon", 542 data: "{}", 543 contentType: 'application/json; charset=utf-8', 544 dataType: "json", 545 async: false, 546 success: function (res) { 547 var result = res.d; 548 if (result != null) { 549 if (result.CouponStatus == "Success") { 550 $(".noCoupon").removeClass("d-none"); 551 $(".appliedCoupon").addClass("d-none"); 552 $(".error").html("Coupon Removed"); 553 $(".resultdata").html(""); 554 $(".Appliedcpndata").html(" "); 555 $(".discountcpn").html(""); 556 } 557 $(".totalamountsave").html("You are saving â¹" + result.TotalSavings + " on this order"); 558 $(".Ordertotaldata").html("<del>â¹" + result.ActSubTotal + "</del> <span>â¹" + result.SubTotal + "</span>"); 559 $(".shippingTotal").html(result.Shipping == "0" || result.Shipping == "" ? "<span class='text-dec'>â¹100</span> <span class='text-green'>Free</span>" : "<span >â¹100</span>"); 560 $(".gtotal").html("â¹" + result.FinalAmount); 561 } 562 }, 563 error: function (data) { 564 } 565 }); 566 } 567 }); 568 569 570 //$(document.body).on('click', ".closeBtn", function () { 571 // $(".resultdata").empty(); 572 // $(".cerror").empty(); 573 // $(".txtCoupon").val(""); 574 //}); 575 576 577 578 579 580 581 582}); 583function TotalNoOfPax() { 584 var x = 0; $(".qty").each(function () { 585 if (!isNaN($(this).val())) 586 x += parseInt($(this).val()); 587 }); return x; 588} 589function ItemCart(id, pid, qty) { 590 var parameter = { "id": id, "p_id": pid, "qty": qty }; 591 $.ajax({
592 type: "POST", 593 url: "/Backend.asmx/AddToCart", 594 data: JSON.stringify(parameter), 595 contentType: 'application/json; charset=utf-8', 596 success: function (data) { 597 $("#success-alert").css("display", "block"); 598 $("#Successmessage").empty(); 599 $("#Successmessage").append("<strong>Success! </strong>Product added to cart successfully."); 600 $("#success-alert").fadeTo(2000, 500).slideUp(500, 601 function () { $("#success-alert").slideUp(500); }); 602 if (data.d.length > 0) { 603 window.location.href = "/cart.aspx"; 604 } 605 }, error: function (data, success, error) { } 606 }); 607} 608function seourl(url) { 609 var strArr = url.split(' '); var resulturl = ""; for (var i = 0; i < strArr.length; i++) { 610 if (resulturl === "") { resulturl = strArr[i]; } 611 else { resulturl = resulturl + "-" + strArr[i]; } 612 } 613 return resulturl; 614} 615function GetCart() { 616 $.ajax({ 617 type: "POST", 618 url: "/Backend.asmx/GetUserCart", 619 data: "{}", 620 contentType: 'application/json; charset=utf-8', 621 success: function (data) { 622 var product_ = data.d; 623 CartView(product_); 624 }, 625 error: function (data, success, error) { 626 } 627 }); 628} 629function CartView(product_) { 630 var itemlistArray = []; 631 var cList = ""; var price = 0; 632 for (var i = 0; i < product_.length; i++) { 633 price += (parseFloat(product_[i].DiscountPrice) * parseFloat(product_[i].Qty)); 634 cList += "<tr class='alert'>"; cList += "<td class='product-item-img'>"; 635 cList += "<img src='/" + product_[i].ProductImage + "' alt=''></td>"; 636 cList += "<td class='product-item-name'>" + product_[i].ProductName + "</td>"; 637 cList += "<td class='product-item-price'>Rs. " + product_[i].DiscountPrice + "</td>"; 638 cList += "<td class='product-item-quantity'>"; 639 cList += "<span>"; 640 cList += "<button id='m_" + product_[i].Id + "' class='addcart cminus'>- </button>"; 641 cList += "</span><span class='addcart1'>"; 642 cList += "<input type='text' class='addcart2' id='qty_" + product_[i].Id + "' value='" + product_[i].Qty + "' /></span><span>"; 643 cList += "<button id='p_" + product_[i].Id + "' class='addcart cplus'>+ </button>"; 644 cList += "</span>"; 645 cList += "</td>"; 646 cList += "<td class='product-item-totle'>Rs. " + (parseFloat(product_[i].DiscountPrice) * parseFloat(product_[i].Qty)) + "</td>"; 647 cList += "<td class='product-item-close'><a id='del_" + product_[i].Id + "' href='javascript:void();' data-dismiss='alert' class='fa fa-times deletecart'></a></td>"; 648 cList += "</tr>"; 649 650 651 652 653 654 var itemArray = { 655 item_id: 'SKU_' + product_[i].ProductId, 656 item_name: product_[i].ProductName, 657 affiliation: 'Google Merchandise Store', 658 discount: (parseFloat(product_[i].ActualPrice) - parseFloat(product_[i].DiscountPrice)), 659 index: 0, 660 price: parseFloat(product_[i].DiscountPrice), 661 quantity: parseFloat(product_[i].Qty) 662 }; 663 itemlistArray.push(itemArray) 664 665 } 666 if (product_.length > 0) { 667 var delamt = parseFloat(product_[0].lstShip[0].OrderAmount); 668 var shpamt = parseFloat(product_[0].lstShip[0].ShippingAmount); 669 var ship = price >= delamt ? 0 : shpamt; 670 $(".subTotal").empty(); 671 $(".shipping").empty(); 672 $(".finalTotal").empty(); 673 $(".subTotal").append(price.toString()); 674 $(".shipping").append(ship.toString()); 675 $(".finalTotal").append((price + ship).toString()); 676 $(".cartRow").empty(); 677 $(".cartRow").append(cList); 678 679 gtag("event", "view_cart", { 680 currency: "INR", 681 value: price + ship, 682 items: itemlistArray 683 }); 684 } 685 else { 686 $(".cartBody").empty(); 687 $(".cartBody").append("<div class='col-md-12'><h3>No items are available in cart</h3></div>"); 688 } 689} 690 691function NewCheckCartView(product_) { 692 693 var cList = ""; var price = 0; var actuaalprice = 0; 694 for (var i = 0; i < product_.length; i++) { 695 actuaalprice += (parseFloat(product_[i].ActualPrice) * parseFloat(product_[i].Qty)); 696 price += (parseFloat(product_[i].DiscountPrice) * parseFloat(product_[i].Qty)); 697 var pcurl = "/shop/" + product_[i].ProductUrl; 698 cList += "<div class='item-lits'>"; 699 cList += "<div class='item-sec'>"; 700 cList += "<div class='img-sec'>"; 701 cList += "<a href='" + pcurl + "'>"; 702 cList += "<img src='" + product_[i].ProductImage + "' alt='Alternate Text' />"; 703 cList += "</a>"; 704 cList += "</div>"; 705 cList += "<div class='text-sec'>"; 706 cList += "<h4><a href='" + pcurl + "'>" + product_[i].ProductName + "</a></h4>"; 707 cList += "<div class='price-lists'>"; 708 cList += "<h5>â¹ " + (parseFloat(product_[i].DiscountPrice)) + "<del>â¹ " + (parseFloat(product_[i].ActualPrice)) + "</del></h5>"; 709 cList += "<div class='product-item-quantity'>"; 710 cList += "<span> <button id='m_" + product_[i].Id + "' class='addcart cminus'>- </button></span>"; 711 cList += "<span class='addcart1'> <input type='text' class='addcart2'id='qty_" + product_[i].Id + "' value='" + product_[i].Qty + "'></span>"; 712 cList += "<span><button id='p_" + product_[i].Id + "' class='addcart cplus'>+ </button></span>"; 713 cList += "</div>"; 714 cList += "<h6><a id='del_" + product_[i].Id + "' href='javascript:void();
714' class='deletecart'><i class='fa fa-trash' aria-hidden='true'></i> </a> </h6>"; 715 cList += "</div>"; 716 cList += "</div>"; 717 cList += "</div>"; 718 cList += "</div>"; 719 } 720 if (product_.length > 0) { 721 var delamt = parseFloat(product_[0].lstShip[0].OrderAmount); 722 var shpamt = parseFloat(product_[0].lstShip[0].ShippingAmount); 723 var ship = price >= delamt ? 0 : shpamt; 724 var savamnt = parseFloat(actuaalprice.toString()) - parseFloat(price.toString()); 725 $(".Ordertotaldata").empty(); 726 $(".gtotal").empty(); 727 $(".totalamountsave").empty(); 728 $(".totalamountsave").append("<p>You are saving â¹" + savamnt + "on this order</p>"); 729 $(".Ordertotaldata").append("<del data-tp='" + (actuaalprice).toString() + "'>â¹ " + (actuaalprice).toString() + "</del><span data-sp='" + (price.toString()) + "'> â¹" + (price.toString()) + "</span>"); 730 // $(".actualtotal").append("<p><p>â¹" + (actuaalprice).toString()); 731 var cpnvals = 0; 732 var Appliedcpn = parseFloat($(".getcdata").attr("d-cvalue")); 733 var Appliedcode = parseFloat($(".getcdata").attr("d-ccode")); 734 if (Appliedcpn > cpnvals) { 735 price = price - Appliedcpn; 736 $(".appliedvalcpn").removeClass("d-none"); 737 $(".Appliedcpndata").val("" + Appliedcode + " applied!"); 738 } 739 $(".gtotal").append("â¹" + price); 740 $(".checkitemproductlst").empty(); 741 $(".checkitemproductlst").append(cList); 742 } 743 else { 744 $(".checkitemproductlst").empty(); 745 $(".checkitemproductlst").append("<div class='col-md-12'><h3>No items are available in cart</h3></div>"); 746 } 747} 748function BindAllCoupons() { 749 $.ajax({
750 type: "POST", 751 url: "/Backend.asmx/GetCouponcode", 752 data: "{}", 753 contentType: 'application/json; charset=utf-8', 754 dataType: "json", 755 async: false, 756 success: function (res) { 757 var coupns = res.d; 758 var cpnlists = ""; 759 760 $(".cpnlist").empty(); 761 coupcnt = coupns.length; 762 if (coupns.length > 0) { 763 for (var i = 0; i < coupns.length; i++) { 764 // cpnlists += "<div><p><img src='assets/img/discount.png' class='discountImg'> " + coupns[i].CouponCod + " <a href='javascript:void(0);' data-value='" + coupns[i].CouponValue + "' data-type='" + coupns[i].CouponType + "' data-val='" + coupns[i].CouponCod + "' data-id='" + coupns[i].Id + "' data-pname='" + coupns[i].ProductName + "' data-vtye='" + coupns[i].CouponValueType + "' date-prc='" + coupns[i].CouponPrice + "' class='Applycpnoffer'>Apply</a></p><div><p class='couponDetailInfoInCart'>" + coupns[i].Description + "</p></div>"; 765 cpnlists += "<div class='coupons-box'>"; 766 cpnlists += "<h4>" + coupns[i].CouponTitle + "</h4>"; 767 cpnlists += "<p>" + coupns[i].Description + "</p>"; 768 cpnlists += "<div class='coupon-ftr'>"; 769 cpnlists += "<div class='coupons'>" + coupns[i].CouponCod + "</div>"; 770 cpnlists += "<div class='apply_remove Applycpnoffer' data-value='" + coupns[i].CouponValue + "' data-type='" + coupns[i].CouponType + "' data-val='" + coupns[i].CouponCod + "' data-id='" + coupns[i].Id + "' data-pname='" + coupns[i].ProductName + "' data-vtye='" + coupns[i].CouponValueType + "' date-prc='" + coupns[i].CouponPrice + "'>Apply</div>"; 771 cpnlists += "</div>"; 772 cpnlists += "</div>"; 773 774 } 775 776 $(".cpnlist").append(cpnlists); 777 } else { 778 779 $(".cpnlist").append("No Offers"); 780 } 781 } 782 }); 783 784}; 785 786 787 788 789 790 791function GetCartCount() { 792 $.ajax({
793 type: "POST", 794 url: "/Backend.asmx/GetCartCount", 795 data: "{}", 796 contentType: 'application/json; charset=utf-8', 797 success: function (data) { 798 $(".cartqty1").empty(); 799 $(".cartqty1").append(data.d.toString()); 800 }, error: function (data, success, error) { 801 } 802 }); 803} 804function RatingIn(val) { 805 $(".productRating .fa-star").css("color", "black"); 806 for (var i = 0; i < parseInt(val); i++) 807 $(".st" + (i + 1)).css("color", "#ffc300"); 808} 809function RatingOut() { 810 $(".productrating .fa-star").css("color", "black"); 811 var val = $(".txtRating").val(); 812 for (var i = 0; i < parseInt(val); i++) 813 $(".st" + (i + 1)).css("color", "#ffc300"); 814} 815function LeadReview1stTime() { 816 $(".rating-star .fa-star").css("color", "black"); 817 var val = $(".txtRating").val(); 818 for (var i = 0; i < parseInt(val); i++) 819 $(".st" + (i + 1)).css("color", "#ffc300"); 820} 821function ValidateEmail(email) { 822 var expr = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; 823 return expr.test(email); 824}; 825//function isPhoneNumber(evt) { 826// evt = (evt) ? evt : window.event; 827// var charCode = (evt.which) ? evt.which : evt.keyCode; 828// switch (charCode < 48 || charCode > 57) { 829// case true: if (charCode == 45 || charCode == 43 || charCode == 46 || charCo
829de == 32) { 830// return true; 831// } else { return false; }; 832// case false: return true; break; 833// } 834//}; 835function BuyNowCheckout(id, pid, qty) { 836 var parameter = { "id": id, "p_id": pid, "qty": qty }; $.ajax({ 837 type: "POST", url: "/Backend.asmx/AddToCart", 838 data: JSON.stringify(parameter), 839 contentType: 'application/json; charset=utf-8', 840 async: false, 841 success: function (data) { 842 var product_ = data.d; 843 if (product_.length > 0) { 844 var itemArray = { 845 item_id: 'SKU_' + product_[0].ProductId, 846 item_name: product_[0].ProductName, 847 affiliation: 'Google Merchandise Store', 848 discount: (parseFloat(product_[0].ActualPrice) - parseFloat(product_[0].DiscountPrice)), 849 index: 0, 850 price: parseFloat(product_[0].DiscountPrice), 851 quantity: parseFloat(product_[0].Qty) 852 }; 853 854 855 gtag("event", "add_to_cart", { 856 currency: "INR", 857 value: (parseFloat(product_[0].DiscountPrice) * parseFloat(product_[0].Qty)), 858 items: [itemArray] 859 }); 860 } 861 GetCartCount(); 862 window.location = "/checkout.aspx"; 863 }, error: function (data, success, error) { } 864 }); 865} 866function ItemCartNew(id, pid, qty) { 867 868 var parameter = { "id": id, "p_id": pid, "qty": qty }; 869 $.ajax({
870 type: "POST", url: "/Backend.asmx/AddToCart", data: JSON.stringify(parameter), 871 contentType: 'application/json; charset=utf-8', async: false, 872 success: function (data) { 873 874 875 var product_ = data.d; 876 if (product_.length > 0) { 877 var itemArray = { 878 item_id: 'SKU_' + product_[0].ProductId, 879 item_name: product_[0].ProductName, 880 affiliation: 'Google Merchandise Store', 881 discount: (parseFloat(product_[0].ActualPrice) - parseFloat(product_[0].DiscountPrice)), 882 index: 0, 883 price: parseFloat(product_[0].DiscountPrice), 884 quantity: parseFloat(product_[0].Qty) 885 }; 886 887 888 gtag("event", "add_to_cart", { 889 currency: "INR", 890 value: (parseFloat(product_[0].DiscountPrice) * parseFloat(product_[0].Qty)), 891 items: [itemArray] 892 }); 893 } 894 895 896 897 898 GetCartCount(); 899 900 $("#success-alert").css("display", "block"); 901 $("#Successmessage").empty(); $("#Successmessage").append("<strong>Success! </strong>Product added to cart successfully."); $("#success-alert").fadeTo(2000, 500).slideUp(500, function () { $("#success-alert").slideUp(500); }); 902 }, 903 error: function (data, success, error) { } 904 }); 905} 906 907 908function RemoveCartGtag(id) { 909 910 var parameter = { "id": id }; 911 $.ajax({
912 type: 'POST', 913 url: "/Backend.asmx/GetCartDetailsToRemoveCart", 914 data: JSON.stringify(parameter), 915 contentType: 'application/json; charset=utf-8', 916 dataType: "json", 917 async: false, 918 success: function (data) { 919 var product_ = data.d; 920 if (product_.length > 0) { 921 var itemArray = { 922 item_id: 'SKU_' + product_[0].ProductId, 923 item_name: product_[0].ProductName, 924 affiliation: 'Google Merchandise Store', 925 discount: (parseFloat(product_[0].ActualPrice) - parseFloat(product_[0].DiscountPrice)), 926 index: 0, 927 price: parseFloat(product_[0].DiscountPrice), 928 quantity: parseFloat(product_[0].Qty) 929 }; 930 931 932 gtag("event", "remove_from_cart", { 933 currency: "INR", 934 value: (parseFloat(product_[0].DiscountPrice) * parseFloat(product_[0].Qty)), 935 items: [itemArray] 936 }); 937 } 938 939 } 940 }); 941} 942 943function ItemViewed(id) { 944 var parameter = { "id": id }; 945 $.ajax({
946 type: 'POST', 947 url: "/Backend.asmx/GetProductDetailById", 948 data: JSON.stringify(parameter), 949 contentType: 'application/json; charset=utf-8', 950 dataType: "json", 951 async: false, 952 success: function (data) { 953 var product_ = data.d; 954 if (product_.length > 0) { 955 var itemArray = { 956 item_id: 'SKU_' + product_[0].Id, 957 item_name: product_[0].ProductName, 958 affiliation: 'Google Merchandise Store', 959 discount: (parseFloat(product_[0].ActualPrice) - parseFloat(product_[0].DiscountPrice)), 960 index: 0, 961 price: parseFloat(product_[0].DiscountPrice), 962 quantity: 1 963 }; 964 gtag("event", "select_item", { 965 item_list_id: "related_products", 966 item_list_name: "", 967 items: [itemArray] 968 }); 969 970 } 971 } 972 }); 973}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.