function Add(visitorId, productId, quantity, sellerProductStockId, comboId) {
$.ajax({
type: "POST",
url: "/Home.aspx/AddToCart",
dataType: "json",
data: JSON.stringify({ VisitorId: visitorId, ProductId: productId, Quantity: quantity, SellerProductStockId: sellerProductStockId, ComboId: comboId }),
contentType: "application/json; charset=utf-8",
success: function (response) {
if (response.d != "") {
document.getElementById("lblCartCount").innerHTML = response.d.split(":")[0];
if ((response.d).split(':')[1] == 2) {
alert("The order limited to 20000 per purchase..");
}
}
},
failure: function (response) {
},
error: function (response) {
}
});
}
function Add(visitorId, productId, quantity, sellerProductStockId, comboId, sender) {
$.ajax({
type: "POST",
url: "/Home.aspx/AddToCart",
dataType: "json",
data: JSON.stringify({ VisitorId: visitorId, ProductId: productId, Quantity: quantity, SellerProductStockId: sellerProductStockId, ComboId: comboId }),
contentType: "application/json; charset=utf-8",
success: function (response) {
if (response.d != "") {
document.getElementById("lblCartCount").innerHTML = response.d.split(":")[0];
if ((response.d).split(':')[2] == 1) {
fly(sender);
$(sender).parent().find(".minuscart").css("pointer-events", "none");
$(sender).parent().find(".minuscart").css("opacity", "0.3");
}
else {
fly(sender);
$(sender).parent().find(".minuscart").css("pointer-events", "auto");
$(sender).parent().find(".minuscart").css("opacity", "1");
}
if ((response.d).split(':')[1] == 2) {
alert("The order limited to 20000 per purchase..");
}
}
},
failure: function (response) {
},
error: function (response) {
}
});
}
function AddPlus(visitorId, productId, quantity, sellerProductStockId, comboId, sender) {
$.ajax({
type: "POST",
url: "/Home.aspx/AddToCart",
dataType: "json",
data: JSON.stringify({ VisitorId: visitorId, ProductId: productId, Quantity: quantity, SellerProductStockId: sellerProductStockId, ComboId: comboId }),
contentType: "application/json; charset=utf-8",
success: function (response) {
if (response.d != "") {
document.getElementById("lblCartCount").innerHTML = response.d.split(":")[0];
$(sender).parent().find(".minuscart").css("pointer-events", "auto");
$(sender).parent().find(".minuscart").css("opacity", "1");
fly(sender);
if ((response.d).split(':')[1] == 2) {
alert("The order limited to 20000 per purchase..");
}
}
},
failure: function (response) {
},
error: function (response) {
}
});
}
$('#popupBoxClose').click(function () {
unloadPopupBox();
});
$('#overlay').click(function () {
unloadPopupBox();
});
function unloadPopupBox() { // TO Unload the Popupbox
$("#overlay").hide();
$('#popup_box').fadeOut("slow");
}
function loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender) { // To Load the Popupbox
$('#popup_box').fadeIn("slow");
$("#overlay").show();
var PinResproductId = productId;
var cartdecide;
$("#lbtnCart").click(function (e) {
var pincode = $("#txtPincode").val();
var eq;
var eq1;
if (pincode != "" && pincode.length == 6) {
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pincode, ProductId: PinResproductId }),
contentType: "application/json; charset=utf-8",
success: function (response) {
if (response.d != "") {
document.getElementById("Avilability").style.display = "block";
if ((response.d).split(':')[1] == 1 && (response.d).split(':')[2] == 0) {
document.getElementById("lblDelivery").innerHTML = " Delivery : Not Availlable ";
document.getElementById("hfdPincode").value = 0;
cartdecide = 0;
}
else if ((response.d).split(':')[1] == 1) {
document.getElementById("lblDelivery").innerHTML = " Delivery : Available ";
document.getElementById("hfdPincode").value = pincode;
cartdecide = 1;
}
else {
document.getElementById("lblDelivery").innerHTML = " Delivery : Not Available ";
document.getElementById("hfdPincode").value = 0;
cartdecide = 0;
}
if ((response.d).split(':')[0] == 1 && (response.d).split(':')[2] == 0) {
document.getElementById("lblHomeDelivery").innerHTML = " Cash On Delivery : Not Availlable ";
if (cartdecide === 0) {
document.getElementById('btnAddToCartClick').style.display = 'none';
} else {
document.getElementById('btnAddToCartClick').style.display = 'block';
}
}
else if ((response.d).split(':')[0] == 1) {
document.getElementById("lblHomeDelivery").innerHTML = " Payment - Cash On Delivery : Available ";
if (cartdecide === 0) {
document.getElementById('btnAddToCartClick').style.display = 'none';
} else {
document.getElementById('btnAddToCartClick').style.display = 'block';
}
}
else {
document.getElementById("lblHomeDelivery").innerHTML = " Payment - Cash On Delivery : Not Available ";
if (cartdecide === 0) {
document.getElementById('btnAddToCartClick').style.display = 'none';
} else {
document.getElementById('btnAddToCartClick').style.display = 'block';
}
}
}
if (window.matchMedia("(min-width: 240px) and (max-width: 319px)").matches) {
$('#popup_box').addClass("jscript240");
}
if (window.matchMedia("(min-width: 320px) and (max-width: 479px)").matches) {
$('#popup_box').addClass("jscript320");
} if (window.matchMedia("(min-width: 480px) and (max-width: 540px)").matches) {
$('#popup_box').addClass("jscript480");
} if (window.matchMedia("(min-width: 541px) and (max-width: 602px)").matches) {
$('#popup_box').addClass("jscript540");
}
if (window.matchMedia("(min-width: 603px) and (max-width: 767px)").matches) {
$('#popup_box').addClass("jscript603");
}
},
failure: function (response) {
},
error: function (response) {
}
});
}
else {
alert("Please enter a valid 6 digit pincode .");
}
});
}
function CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender) {
$("#btnAddToCartClick").click(function () {
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
$(sender).parent().find(".spnCheckCart").html(0);
quantity = 1;
AddPlus(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
unloadPopupBox();
}
else {
$(sender).parent().find(".spnCheckCart").html(0);
}
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
$(sender).parent().find(".spnCheckCartPrimary").html(0);
quantity = 1;
AddPlusPrimaryProductDetails(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
unloadPopupBox();
}
else {
$(sender).parent().find(".spnCheckCartPrimary").html(0);
}
if ($(sender).parent().find(".spnCheckCartCombos").text() == 1 || $(sender).parent().find(".spnCheckCartCombos").text() == "1") {
$(sender).parent().find(".spnCheckCartCombos").html(0);
quantity = 1;
AddPlusPrimaryProductDetails(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
unloadPopupBox();
}
else {
$(sender).parent().find(".spnCheckCartCombos").html(0);
}
});
}
$('#popupBoxClose1').click(function () {
unloadPopupBox1();
});
$('#overlay1').click(function () {
unloadPopupBox1();
});
function unloadPopupBox1() { // TO Unload the Popupbox
$("#overlay1").hide();
$('#popup_box1').fadeOut("slow");
}
function loadPopupBox1() { // To Load the Popupbox
$('#popup_box1').fadeIn("slow");
$("#overlay1").show();
}
function fly(sender) {
var cart = $('.shopping-cartfresh');
var imgtodrag = $(sender).parent().parent().parent().find("img").eq(0);
if (imgtodrag) {
var imgclone = imgtodrag.clone()
.offset({
top: imgtodrag.offset().top,
left: imgtodrag.offset().left
})
.css({
'opacity': '0.8',
'position': 'absolute',
'height': '150px',
'width': '150px',
'z-index': '100'
})
.appendTo($('body'))
.animate({
'top': cart.offset().top,
'left': cart.offset().left,
'width': 1,
'height': 1
}, 1500, 'easeOutBounce');
imgclone.animate({
'width': 0,
'height': 0
}, function () {
$(this).detach();
});
}
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '/Resource/throw.mp3');
$.get();
audioElement.addEventListener("load", function () {
audioElement.play();
}, true);
audioElement.play();
}
function AddPlusPrimaryProductDetails(visitorId, productId, quantity, SellerProductStockId, comboId, sender) {
$.ajax({
type: "POST",
url: "/Home.aspx/AddToCart",
dataType: "json",
data: JSON.stringify({ VisitorId: visitorId, ProductId: productId, Quantity: quantity, SellerProductStockId: SellerProductStockId, ComboId: comboId }),
contentType: "application/json; charset=utf-8",
success: function (response) {
if (response.d != "") {
document.getElementById("lblCartCount").innerHTML = response.d.split(":")[0];
$(sender).parent().find(".minuscart").css("pointer-events", "auto");
$(sender).parent().find(".minuscart").css("opacity", "1");
flyPrimaryProductDetailsCombos(sender);
if ((response.d).split(':')[1] == 2) {
alert("The order limited to 20000 per purchase..");
}
}
},
failure: function (response) {
},
error: function (response) {
}
});
}
function flyPrimaryProductDetails(sender) {
var cart = $('.shopping-cartfresh');
var imgtodrag = $(sender).parent().parent().parent().parent().parent().parent().find("img").eq(0);
if (imgtodrag) {
var imgclone = imgtodrag.clone()
.offset({
top: imgtodrag.offset().top,
left: imgtodrag.offset().left
})
.css({
'opacity': '0.8',
'position': 'absolute',
'height': '150px',
'width': '150px',
'z-index': '100'
})
.appendTo($('body'))
.animate({
'top': cart.offset().top,
'left': cart.offset().left,
'width': 1,
'height': 1
}, 1500, 'easeOutBounce');
imgclone.animate({
'width': 0,
'height': 0
}, function () {
$(this).detach();
});
}
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '/Resource/throw.mp3');
$.get();
audioElement.addEventListener("load", function () {
audioElement.play();
}, true);
audioElement.play();
}
function flyPrimaryProductDetailsCombos(sender) {
var cart = $('.shopping-cartfresh');
var imgtodrag = $(sender).parent().parent().parent().find("img").eq(0);
if (imgtodrag.length != 1) {
var imgtodrag1 = $(sender).parent().parent().parent().parent().parent().parent().parent().find("img").eq(0);
var imgclone1 = imgtodrag1.clone()
.offset({
top: imgtodrag1.offset().top,
left: imgtodrag1.offset().left
})
.css({
'opacity': '0.8',
'position': 'absolute',
'height': '150px',
'width': '150px',
'z-index': '100'
})
.appendTo($('body'))
.animate({
'top': cart.offset().top,
'left': cart.offset().left,
'width': 1,
'height': 1
}, 1500, 'easeOutBounce');
imgclone1.animate({
'width': 0,
'height': 0
}, function () {
$(this).detach();
});
}
else {
if (imgtodrag) {
var imgclone = imgtodrag.clone()
.offset({
top: imgtodrag.offset().top,
left: imgtodrag.offset().left
})
.css({
'opacity': '0.8',
'position': 'absolute',
'height': '150px',
'width': '150px',
'z-index': '100'
})
.appendTo($('body'))
.animate({
'top': cart.offset().top,
'left': cart.offset().left,
'width': 1,
'height': 1
}, 1500, 'easeOutBounce');
imgclone.animate({
'width': 0,
'height': 0
}, function () {
$(this).detach();
});
}
}
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '/Resource/throw.mp3');
$.get();
audioElement.addEventListener("load", function () {
audioElement.play();
}, true);
audioElement.play();
}
//-----------------------------Special And Latest Products add to cart ("+") button clicks - Starts---------------------------
function SetRDAvaillableForSpecial(SellerProductStockId, RestrictedDelivery, ProductId, sender) {
var rda;
var productId = ProductId;
var pin = $("#hfdPincode").val();
pin = parseInt(pin);
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
addToCartforSpecialAndLatestProducts(SellerProductStockId, RestrictedDelivery, ProductId, rda, sender);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
//-------------------------Special And Latest Products add to cart ("+") button clicks - Ends-------------------------------
//--------------------------------Special And Latest Products add to cart ("+") button clicks with pincode checking - Starts------------------------
function addToCartforSpecialAndLatestProducts(SellerProductStockId, RestrictedDelivery, ProductId, rda, sender) {
var sellerProductStockId = SellerProductStockId;
var DeliveryRestriction = RestrictedDelivery;
var productId = ProductId;
var visitorId = $("#hfdLatestSpecialProductsVisitorId").val(); // $("#<%=hfdLatestSpecialProductsVisitorId.ClientID%>").val();
var quantity = 1;
var comboId = 0;
var pin = $("#hfdPincode").val();
pin = parseInt(pin); //== Pincode ==//
var RDA = rda; //== RESTRICTED DELIVERY AVAILLABLE == //
var currentVal = parseInt($(sender).parent().find(".lblQuantity").text());
if (DeliveryRestriction !== 0 && RDA === 0 && pin === 0) {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (pin === 0 || pin === "") {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (DeliveryRestriction !== 0 && RDA === 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
}
if (pin !== 0 && DeliveryRestriction === 0) {
quantity = 1;
AddPlus(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
}
else if (pin !== 0 && DeliveryRestriction !== 0 && RDA !== 0) {
quantity = 1;
AddPlus(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
}
}
//------------------------------Special And Latest Products add to cart ("+") button clicks with pincode checking - Ends--------------------------
//------------------------------Special And Latest Products Remove from cart ("-") button clicks with pincode checking - Starts--------------------------
function addToCartforSpecialAndLatestProductsMinus(SellerProductStockId, RestrictedDelivery, ProductId, sender) {
var sellerProductStockId = SellerProductStockId;
var DeliveryRestriction = RestrictedDelivery;
var productId = ProductId;
var visitorId = $("#hfdLatestSpecialProductsVisitorId").val(); // $("#<%=hfdLatestSpecialProductsVisitorId.ClientID%>").val();
var quantity;
var comboId = 0;
var currentVal;
var pin = $("#hfdPincode").val();
pin = parseInt(pin); //== Pincode ==//
var RDA = $("#hfdRestDeliAvaillable").val(); //== RESTRICTED DELIVERY AVAILLABLE == //
var getproductcount;
quantity = -1;
Add(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
}
//----------------------------Special And Latest Products Remove from cart ("-") button clicks with pincode checking - Ends----------------------------
//-----------------Product Cart Updation - Starts---------------------------------------
function OnMouseIn(elem) {
if (document.getElementById("viewCart").style.display == "none" || document.getElementById("lblEmpty").innerText == "") {
var id = elem.id;
$('.loadingdivs').show();
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/LoadCartDetails",
data: "{'keyword':'1'}",
success: function (data) {
var obj = data.d;
var outString1 = "";
outString1 += '
'
+ 'Loading products ...
';
document.getElementById("menuCart").innerHTML = outString1;
//$('.loadingdivs').show();
//var imgPath = ' <%= CommonFunctions.SubDomainPath %>/images';
if (data.d.length != '0' && obj[0].TotalCount != '0') {
//document.getElementById("#<%=lblDiscount.ClientID%>").innerText = (20).ToString("#.##");
//document.getElementById("#<%=lblSumOfCart.ClientID%>").innerText = "Total :" + (200 - 20).ToString("#.##");
// + (cartManagement.NetTotal - cartManagement.Discount).ToString("#.##");
var outString = "";
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
for (var i = 0; i < obj[0].CartProductDetails.length; i++) {
$('.loadingdivs').show();
// res = res.replace(/\+/g, ' ');
var CDN = obj[0].CartProductDetails[i].Cdn;
if (CDN == "1") {
CDN = "http://cdn1.Myrightbuy.com/images/";
}
else if (CDN == "2") {
CDN = "http://cdn2.Myrightbuy.com/images/";
}
else if (CDN == "3") {
CDN = "http://cdn3.Myrightbuy.com/images/";
}
else {
CDN = "http://cdn2.Myrightbuy.com/images/";
}
var imgPath = CDN;
var img = (obj[0].CartProductDetails[i].ProductName).replace(/\ /g, '-');
//
outString += '';
}
document.getElementById("menuCart").innerHTML = outString;
$('.loadingdivs').hide();
//document.getElementById("menuCart").innerHTML = outString1;
// '' +
// ' ' +
// 'Product ' +
// 'Quantity ' +
// 'Volume ' +
// ' Total Price ' +
// '
'+;
document.getElementById("hdfNetTotal").value = parseInt(obj[0].NetTotal);
document.getElementById("hdfMinimumOrderLimit").value = parseInt(obj[0].MinimumOrderLimitAmount);
document.getElementById("lblSumOfCart").innerHTML = 'Net Total : ' + ' ' + (parseInt(obj[0].NetTotal) - parseInt(obj[0].Discount));
document.getElementById("lblSumOfCart").style.display = "block";
if (parseInt(obj[0].Discount) != 0) {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "block";
} else {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "none";
}
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("CartDropdown").style.display = 'block';
document.getElementById("lblEmpty").style.display = "none";
document.getElementById("viewCart").style.display = "block";
} else {
document.getElementById("viewCart").style.display = "none";
document.getElementById("lblEmpty").style.display = "block";
document.getElementById("menuCart").innerHTML = "";
document.getElementById("lblEmpty").innerText = "Your Cart is Empty";
document.getElementById("lblEmpty").style.float = "none";
document.getElementById("lblEmpty").style.min_width = "96px";
document.getElementById("divcardiscount").style.display = "none";
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("lblSumOfCart").style.display = "none";
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
}
},
error: function (result) {
//alert("Error");
}
});
}
}
//---------------------Product Cart Updation - Ends-----------------------------------
//-----------------------Remove Product from Cart - Starts---------------------------------
function RemoveClick(sender) {
var VisitorId = $("#hfdRecentRecommendedProductsVisitorId").val(); // $("#<%=hfdRecentRecommendedProductsVisitorId.ClientID%>").val();
if (confirm('Are you sure you want to Delete this Item?')) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/RemoveProduct",
data: "{'id':'" + sender.id + '/' + VisitorId + "'}",
success: function (data) {
var elem = "a";
OnMouseIn(elem);
},
error: function (result) {
alert("Error");
}
});
}
else {
return false;
};
return false;
}
//------------------------Remove Product from Cart - Ends--------------------------------
//---------------------------Directly enter product count into the Cart textbox - Starts-----------------------------
function txtQuantityblur(sender) {
document.getElementById("lblMinimumOrderLimit").innerHTML = '';
var currentVal = document.getElementById(sender.id).value;
if (currentVal < 1) {
// Increment
document.getElementById(sender.id).value = 1;
}
else if (currentVal > 20) {
// Increment
document.getElementById(sender.id).value = 20;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/UpdateProduct",
data: "{'id':'" + sender.nextElementSibling.id + '/' + document.getElementById(sender.id).value + "'}",
success: function (data) {
var obj = data.d;
if (data.d.length != '0' && obj[0].TotalCount != '0') {
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
document.getElementById("hdfNetTotal").value = parseInt(obj[0].NetTotal);
document.getElementById("hdfMinimumOrderLimit").value = parseInt(obj[0].MinimumOrderLimitAmount);
document.getElementById("lblSumOfCart").innerHTML = 'Net Total : ' + ' ' + (parseInt(obj[0].NetTotal) - parseInt(obj[0].Discount));
document.getElementById("lblSumOfCart").style.display = "block";
if (parseInt(obj[0].Discount) != 0) {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "block";
} else {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "none";
}
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("CartDropdown").style.display = 'block';
document.getElementById("lblEmpty").style.display = "none";
document.getElementById("viewCart").style.display = "block";
} else {
alert("The order limited to 20000 per purchase..");
}
// if (data.d == 2) {
// }
// var elem = "a";
// OnMouseIn(elem);
},
error: function (result) {
alert("Error");
}
});
}
//---------------------------Directly enter product count into the Cart textbox - Ends-----------------------------
//------------------Blinking effect for added product into the cart - Starts--------------------------------------
function toastmsg() {
$('.toastmsg').fadeIn(400).delay(3000).fadeOut(400);
// alert("This is another function");
}
//------------------------Blinking effect for added product into the cart - Ends--------------------------------
//-------------------------Viewed & Recommended Products Add to Cart ("+") Button - Starts-------------------------------
function SetRDAvaillableForViewed(SellerProductStockId, RestrictedDelivery, ProductId, sender) {
var rda;
var productId = ProductId;
var pin = $("#hfdPincode").val();
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
addToCartforViewedandRecommendedProducts(SellerProductStockId, RestrictedDelivery, ProductId, rda, sender);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
//------------------------Viewed & Recommended Products Add to Cart ("+") Button - Ends--------------------------------
//----------------------------Viewed & Recommended Products Add to Cart ("+") Button Pincode Checking - Starts----------------------------
function addToCartforViewedandRecommendedProducts(SellerProductStockId, RestrictedDelivery, ProductId, rda, sender) {
var sellerProductStockId = SellerProductStockId;
var DeliveryRestriction = RestrictedDelivery;
var productId = ProductId;
var visitorId = $("#hfdRecentRecommendedProductsVisitorId").val(); // $("#<%=hfdRecentRecommendedProductsVisitorId.ClientID%>").val();
var quantity = 1;
var comboId = 0;
var pin = $("#hfdPincode").val(); //== Pincode ==//
var RDA = rda; //== RESTRICTED DELIVERY AVAILLABLE == //
var currentVal = parseInt($(sender).parent().find(".lblQuantity").text());
if (DeliveryRestriction != 0 && RDA == 0 && pin == 0) {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (pin == 0 || pin == "") {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (DeliveryRestriction != 0 && RDA == 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
}
if (pin != 0 && DeliveryRestriction == 0) {
quantity = 1;
AddPlus(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
}
else if (pin != 0 && DeliveryRestriction != 0 && RDA != 0) {
quantity = 1;
AddPlus(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
}
}
//---------------------------------Viewed & Recommended Products Add to Cart ("+") Button Pincode Checking - Ends-----------------------
//------------------------------------Viewed & Recommended Products Add to Cart ("-") Button - Starts--------------------
function addToCartforRecentAndRecommendedProductsMinus(SellerProductStockId, RestrictedDelivery, ProductId, sender) {
var sellerProductStockId = SellerProductStockId;
var DeliveryRestriction = RestrictedDelivery;
var productId = ProductId;
var visitorId = $("#hfdRecentRecommendedProductsVisitorId").val(); //$("#<%=hfdRecentRecommendedProductsVisitorId.ClientID%>").val();
var quantity;
var comboId = 0;
var currentVal;
var pin = $("#hfdPincode").val();
pin = parseInt(pin); //== Pincode ==//
var RDA = $("#hfdRestDeliAvaillable").val(); //== RESTRICTED DELIVERY AVAILLABLE == //
var getproductcount;
quantity = -1;
Add(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
}
//-------------------------------------Viewed & Recommended Products Add to Cart ("-") Button - Ends-------------------
//------------------------Mobile, Tablet navigation touch - Starts--------------------------------
//$('.dropdown').on('mouseenter mouseleave click tap', function () {
// $(this).toggleclass("open");
//});
//------------------------Mobile, Tablet navigation touch - Ends--------------------------------
//--------------------Search autocomplete products for "Enter" button - Starts------------------------------------
function KeyDownHandler() {
if (event.keyCode == 13) {
event.returnValue = false;
event.cancel = true;
//document.getElementById('<%=lnkbtnSearch.ClientID%>').click();
document.getElementById('lnkbtnSearch').click();
}
}
//---------------------------Search autocomplete products for "Enter" button - Ends-----------------------------
//--------------------Reset Button Click on Signin Page - Starts------------------------------------
function eraseText() {
document.getElementById('txtPassword').value = "";
document.getElementById('txtEmail').value = "";
// document.getElementById('<%=txtPassword.ClientID %>').value = "";
// document.getElementById('<%=txtEmail.ClientID %>').value = "";
}
//--------------------Reset Button Click on Signin Page - Ends------------------------------------
//--------------------Onam Template Plus Click Function - Starts------------------------------------
function qtyplusClick1(sender) {
plus(sender, 1);
}
function qtyplusClick2(sender) {
plus(sender, 2);
}
function qtyplusClick3(sender) {
plus(sender, 3);
}
function qtyplusClick4(sender) {
plus(sender, 4);
}
function qtyplusClick5(sender) {
plus(sender, 5);
}
function qtyplusClick6(sender) {
plus(sender, 6);
}
function plus(sender, x) {
var uniquId = x;
var preproductid = sender.nextElementSibling.id;
var productId = parseInt(document.getElementById(preproductid).value);
//var getId = sender.id;
var NumId = preproductid.slice(-1);
var A = 'hfdPlus' + x;
var B = 'txtQuantity' + x;
var textboxId = preproductid.replace(A, B);
var C = 'lblPrice' + x;
var priceId = preproductid.replace(A, C);
var qty = parseInt(document.getElementById(textboxId).value);
if (qty != null && qty >= 1 || qty == 0) {
var quantity = (qty + 1);
}
else {
var quantity = 1;
}
if (qty == 0) {
var D = 'hfdprice' + x;
var priceId1 = preproductid.replace(A, D);
var price = parseInt(document.getElementById(priceId1).value);
}
else {
var pr = parseInt(document.getElementById(priceId).innerHTML);
var price = (pr / qty);
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/UpdateOnamProduct",
data: "{'id':'" + productId + '/' + quantity + '/' + price + '/' + NumId + "'}",
success: function (data) {
if (data.d != null) {
var result = data.d
var arr = result.split("/"); ;
document.getElementById(textboxId).value = arr[0];
document.getElementById(priceId).innerHTML = arr[1];
document.getElementById("lblTotal").innerText = arr[2];
}
},
error: function (result) {
alert("Error");
}
});
}
//--------------------Onam Template Plus Click Function - Ends------------------------------------
//--------------------Onam Template minus Click Function - Starts------------------------------------
function qtyminusClick1(sender) {
minus(sender, 1);
}
function qtyminusClick2(sender) {
minus(sender, 2);
}
function qtyminusClick3(sender) {
minus(sender, 3);
}
function qtyminusClick4(sender) {
minus(sender, 4);
}
function qtyminusClick5(sender) {
minus(sender, 5);
}
function qtyminusClick6(sender) {
minus(sender, 6);
}
function minus(sender, x) {
var uniquId = x;
var preproductid = sender.nextElementSibling.id;
var productId = parseInt(document.getElementById(preproductid).value);
var NumId = preproductid.slice(-1);
var A = 'hfdMinus' + x;
var B = 'txtQuantity' + x;
var textboxId = preproductid.replace(A, B);
var C = 'lblPrice' + x;
var priceId = preproductid.replace(A, C);
var qty = parseInt(document.getElementById(textboxId).value);
if (qty != null && qty != 0 && qty > 1) {
var quantity = (qty - 1);
}
else if (qty == 1 || qty == 0) {
var quantity = 0;
}
else {
var quantity = 1;
}
var pr = parseInt(document.getElementById(priceId).innerHTML);
if (qty == 1 || qty == 0) {
var price = 0;
}
else {
var price = (pr / qty);
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/UpdateOnamProduct",
data: "{'id':'" + productId + '/' + quantity + '/' + price + '/' + NumId + "'}",
success: function (data) {
if (data.d != null) {
var result = data.d
var arr = result.split("/"); ;
document.getElementById(textboxId).value = arr[0];
document.getElementById(priceId).innerHTML = arr[1];
document.getElementById("lblTotal").innerText = arr[2];
}
},
error: function (result) {
alert("Error");
}
});
}
//--------------------Onam Template minus Click Function - Ends------------------------------------
//-------------------------------Add to cart for product list page - Starts-------------------------
function SetRDAvaillable(sender) {
var rda;
var ddlselect;
var arrselect;
var productId;
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin);
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
ddlselect = $(sender).parent().parent().parent().find("#ddlActualVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
productId = parseInt(arrselect[2]);
} else {
ddlselect = $(sender).parent().parent().parent().find("#ddlDiscountVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
productId = parseInt(arrselect[2]);
}
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
yourJavaScriptFunction(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function yourJavaScriptFunction(sender, rda) {
var comboId = 0;
var visitorId = $("#hfdVisitorId").val(); // $("#<%=hfdVisitorId.ClientID%>").val();
var ddlselect;
var arrselect;
var SellerProductStockId = "";
var quantity;
var productId;
var currentVal;
var getproductcount;
var DeliveryRestriction;
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin); //== Pincode ==//
var RDA = rda;
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
ddlselect = $(sender).parent().parent().parent().find("#ddlActualVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
DeliveryRestriction = parseInt(arrselect[3]);
productId = parseInt(arrselect[2]);
SellerProductStockId = parseInt(arrselect[0]);
} else {
ddlselect = $(sender).parent().parent().parent().find("#ddlDiscountVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
DeliveryRestriction = parseInt(arrselect[3]);
productId = parseInt(arrselect[2]);
SellerProductStockId = parseInt(arrselect[0]);
}
if (DeliveryRestriction !== 0 && RDA === 0 && pin === 0) {
loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
// if($("#btnAddToCartClick").css("display") == "block"){
// CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
// }
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (pin === 0 || pin === "") {
loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
// if ($("#btnAddToCartClick").css("display") == "block") {
// CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
// }
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (DeliveryRestriction !== 0 && RDA === 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
// if ($("#btnAddToCartClick").css("display") == "block") {
// CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
// }
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
}
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
if ($("#btnAddToCartClick").css("display") == "block") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
}
}
if (pin !== 0 && DeliveryRestriction === 0) {
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
quantity = 1;
} else {
quantity = 1;
}
AddPlus(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
}
else if (pin !== 0 && DeliveryRestriction !== 0 && RDA !== 0) {
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
quantity = 1;
} else {
quantity = 1;
}
AddPlus(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
}
}
//-------------------------------Add to cart for product list page - Ends-------------------------
//-------------------------------Add to cart for filter product list page - Starts-------------------------
function SetRDAvaillableForFilter(sender) {
var rda;
var productId;
var arrSelect;
var ddlSelect;
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin);
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
ddlSelect = $(sender).parent().parent().find(".clddlpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
} else {
ddlSelect = $(sender).parent().parent().parent().parent().find(".clddldiscountpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
}
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
FilterAddTocart(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function FilterAddTocart(sender, rda) {
var DeliveryRestriction; // = RestrictedDelivery;
var arrSelect;
var ddlSelect;
var SellerProductStockId;
var productId;
var Quantity;
var currentVal;
var comboId = 0;
var visitorId = $("#hfdVisitorId").val(); // $("#<%=hfdVisitorId.ClientID%>").val();
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin);
var RDA = rda;
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
ddlSelect = $(sender).parent().parent().find(".clddlpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
SellerProductStockId = parseInt(arrSelect[1]);
DeliveryRestriction = parseInt(arrSelect[4]);
} else {
ddlSelect = $(sender).parent().parent().parent().parent().find(".clddldiscountpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
SellerProductStockId = parseInt(arrSelect[1]);
DeliveryRestriction = parseInt(arrSelect[4]);
}
if (DeliveryRestriction !== 0 && RDA === 0 && pin === 0) {
loadPopupBox(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (pin === 0 || pin === "") {
loadPopupBox(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (DeliveryRestriction !== 0 && RDA === 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
}
if (pin !== 0 && DeliveryRestriction === 0) {
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
Quantity = 1;
}
else {
Quantity = 1;
}
AddPlus(visitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
else if (pin !== 0 && DeliveryRestriction !== 0 && RDA !== 0) {
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
Quantity = 1;
}
else {
Quantity = 1;
}
AddPlus(visitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
}
//-------------------------------Add to cart for filter product list page - Ends-------------------------
//-------------------------------Remove from cart on product list page - Starts-------------------------
function yourJavaScriptFunctionminus(sender) {
var gs;
var arr;
var SellerProductStockId = "";
var Quantity;
var productId;
var currentVal;
var getproductcount;
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
gs = $(sender).parent().parent().parent().find("#ddlActualVolumePrice option:selected").val();
arr = gs.split('|');
SellerProductStockId = parseInt(arr[0]);
productId = parseInt(arr[2]);
$(sender).parent().find(".pluscart").css("pointer-events", "auto");
$(sender).parent().find(".pluscart").css("opacity", "1");
Quantity = -1;
}
else {
gs = $(sender).parent().parent().parent().find("#ddlDiscountVolumePrice option:selected").val();
arr = gs.split('|');
SellerProductStockId = parseInt(arr[0]);
productId = parseInt(arr[2]);
$(sender).parent().find(".pluscart").css("pointer-events", "auto");
$(sender).parent().find(".pluscart").css("opacity", "1");
Quantity = -1; // parseInt($(sender).parent().find("#lblQuantity").text());
}
var VisitorId = $("#hfdVisitorId").val(); // $("#<%=hfdVisitorId.ClientID%>").val();
var comboId = 0;
Add(VisitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
//-------------------------------Remove from cart on product list page - Ends-------------------------
//-------------------------------Remove from cart for filter on product list page - Starts-------------------------
function FilterAddTocartminus(sender) {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '/Resource/throw.mp3');
$.get();
audioElement.addEventListener("load", function () {
audioElement.play();
}, true);
audioElement.play();
var arr;
var gs;
var SellerProductStockId;
var productId;
var Quantity;
var currentVal;
var getproductcount;
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
gs = $(sender).parent().parent().find(".clddlpricevolume option:selected").val();
arr = gs.split('|');
productId = parseInt(arr[0]);
SellerProductStockId = parseInt(arr[1]);
Quantity = -1;
}
else {
gs = $(sender).parent().parent().parent().parent().find(".clddldiscountpricevolume option:selected").val();
arr = gs.split('|');
productId = parseInt(arr[0]);
SellerProductStockId = parseInt(arr[1]);
Quantity = -1;
}
var VisitorId = $("#hfdVisitorId").val(); // $("#<%=hfdVisitorId.ClientID%>").val();
var comboId = 0;
Add(VisitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
//-------------------------------Remove from cart for filter on product list page - Ends-------------------------
//-------------------------------add to cart on search page - Starts-------------------------
function SetRDAvaillableSearch(sender) {
var rda;
var ddlselect;
var arrselect;
var productId;
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin);
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
ddlselect = $(sender).parent().parent().parent().find("#ddlActualVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
productId = parseInt(arrselect[2]);
} else {
ddlselect = $(sender).parent().parent().parent().find("#ddlDiscountVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
productId = parseInt(arrselect[2]);
}
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
addToCartforSearchProducts(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function addToCartforSearchProducts(sender, rda) {
var comboId = 0;
var visitorId = $("#hfdSearchProductsVisitorId").val(); // $("#<%=hfdSearchProductsVisitorId.ClientID%>").val();
var ddlselect;
var arrselect;
var SellerProductStockId = "";
var quantity;
var productId;
var currentVal;
var getproductcount;
var DeliveryRestriction;
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin); //== Pincode ==//
var RDA = rda;
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
ddlselect = $(sender).parent().parent().parent().find("#ddlActualVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
DeliveryRestriction = parseInt(arrselect[3]);
productId = parseInt(arrselect[2]);
SellerProductStockId = parseInt(arrselect[0]);
} else {
ddlselect = $(sender).parent().parent().parent().find("#ddlDiscountVolumePrice option:selected").val();
arrselect = ddlselect.split('|');
DeliveryRestriction = parseInt(arrselect[3]);
productId = parseInt(arrselect[2]);
SellerProductStockId = parseInt(arrselect[0]);
}
if (DeliveryRestriction !== 0 && RDA === 0 && pin === 0) {
loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (pin === 0 || pin === "") {
loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (DeliveryRestriction !== 0 && RDA === 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
}
if (pin !== 0 && DeliveryRestriction === 0) {
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
quantity = 1;
} else {
quantity = 1;
}
AddPlus(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
}
else if (pin !== 0 && DeliveryRestriction !== 0 && RDA !== 0) {
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
quantity = 1;
} else {
quantity = 1;
}
AddPlus(visitorId, productId, quantity, SellerProductStockId, comboId, sender);
}
}
//-------------------------------add to cart on search page - Ends-------------------------
//-------------------------------add to cart for filter on search page - Starts-------------------------
function SetRDAvaillableForFilterSearch(sender) {
var rda;
var productId;
var arrSelect;
var ddlSelect;
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin);
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
ddlSelect = $(sender).parent().parent().find(".clddlpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
} else {
ddlSelect = $(sender).parent().parent().parent().parent().find(".clddldiscountpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
}
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
FilterAddTocartSearch(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function FilterAddTocartSearch(sender, rda) {
var DeliveryRestriction; // = RestrictedDelivery;
var arrSelect;
var ddlSelect;
var SellerProductStockId;
var productId;
var Quantity;
var currentVal;
var comboId = 0;
var visitorId = $("#hfdSearchProductsVisitorId").val(); // $("#<%=hfdSearchProductsVisitorId.ClientID%>").val();
var pin = $("#hfdPincode").val(); ;
pin = parseInt(pin);
var RDA = rda;
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
ddlSelect = $(sender).parent().parent().find(".clddlpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
SellerProductStockId = parseInt(arrSelect[1]);
DeliveryRestriction = parseInt(arrSelect[4]);
} else {
ddlSelect = $(sender).parent().parent().parent().parent().find(".clddldiscountpricevolume option:selected").val();
arrSelect = ddlSelect.split('|');
productId = parseInt(arrSelect[0]);
SellerProductStockId = parseInt(arrSelect[1]);
DeliveryRestriction = parseInt(arrSelect[4]);
}
if (DeliveryRestriction !== 0 && RDA === 0 && pin === 0) {
loadPopupBox(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (pin === 0 || pin === "") {
loadPopupBox(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
}
if (DeliveryRestriction !== 0 && RDA === 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCart").text() == 1 || $(sender).parent().find(".spnCheckCart").text() == "1") {
CartConfirmation(productId, visitorId, Quantity, SellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
}
if (pin !== 0 && DeliveryRestriction === 0) {
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
Quantity = 1;
}
else {
Quantity = 1;
}
AddPlus(visitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
else if (pin !== 0 && DeliveryRestriction !== 0 && RDA !== 0) {
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
Quantity = 1;
}
else {
Quantity = 1;
}
AddPlus(visitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
}
//-------------------------------add to cart for filter on search page - Ends-------------------------
//-------------------------------Remove from cart on search page - Starts-------------------------
function yourJavaScriptFunctionminusSearch(sender) {
var gs;
var arr;
var SellerProductStockId = "";
var Quantity;
var productId;
var currentVal;
var getproductcount;
if ($(sender).parent().parent().find(".actualprice").css("display") === "block") {
gs = $(sender).parent().parent().parent().find("#ddlActualVolumePrice option:selected").val();
arr = gs.split('|');
SellerProductStockId = parseInt(arr[0]);
productId = parseInt(arr[2]);
$(sender).parent().find(".pluscart").css("pointer-events", "auto");
$(sender).parent().find(".pluscart").css("opacity", "1");
Quantity = -1;
}
else {
gs = $(sender).parent().parent().parent().find("#ddlDiscountVolumePrice option:selected").val();
arr = gs.split('|');
SellerProductStockId = parseInt(arr[0]);
productId = parseInt(arr[2]);
$(sender).parent().find(".pluscart").css("pointer-events", "auto");
$(sender).parent().find(".pluscart").css("opacity", "1");
Quantity = -1;
}
var VisitorId = $("#hfdSearchProductsVisitorId").val(); // $("#<%=hfdSearchProductsVisitorId.ClientID%>").val();
var comboId = 0;
Add(VisitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
//-------------------------------Remove from cart on search page - Ends-------------------------
//-------------------------------Remove from cart for Filter on search page - Starts-------------------------
function FilterAddTocartminusSearch(sender) {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '/Resource/throw.mp3');
$.get();
audioElement.addEventListener("load", function () {
audioElement.play();
}, true);
audioElement.play();
var arr;
var gs;
var SellerProductStockId;
var productId;
var Quantity;
var currentVal;
var getproductcount;
if ($(sender).parent().parent().find(".pprice").is(':visible')) {
gs = $(sender).parent().parent().find(".clddlpricevolume option:selected").val();
arr = gs.split('|');
productId = parseInt(arr[0]);
SellerProductStockId = parseInt(arr[1]);
Quantity = -1;
fly(sender);
}
else {
gs = $(sender).parent().parent().parent().parent().find(".clddldiscountpricevolume option:selected").val();
arr = gs.split('|');
productId = parseInt(arr[0]);
SellerProductStockId = parseInt(arr[1]);
Quantity = -1;
fly(sender);
}
var VisitorId = $("#hfdSearchProductsVisitorId").val(); // $("#<%=hfdSearchProductsVisitorId.ClientID%>").val();
var comboId = 0;
Add(VisitorId, productId, Quantity, SellerProductStockId, comboId, sender);
}
//-------------------------------Remove from cart for Filter on search page - Ends-------------------------
//-------------------------------Decrease Product Quantity on Product Details Page - Starts-------------------------
function qtyminus(sender) {
// Stop acting like a button
// Get the field name
// Get its current value
var currentVal = parseInt(document.getElementById("txtChangeQuantity").value);
if (!isNaN(currentVal) && currentVal > 1) {
// Decrement one
document.getElementById("txtChangeQuantity").value = currentVal - 1;
} else {
// Otherwise put a 0 there
document.getElementById("txtChangeQuantity").value = 1;
}
var data = $("#ddlQuantity").val();
// alert(data);
var arr = data.split('/');
var price = arr[1];
var qty = $("#txtChangeQuantity").val();
$("#txtUpdatedPrice").html(qty * price);
// AddtoCart();
}
//-------------------------------Decrease Product Quantity on Product Details Page - Ends-------------------------
//-------------------------------Increase Product Quantity on Product Details Page - Starts-------------------------
// This button will decrement the value till 0
function qtyplus(sender) {
// Stop acting like a button
// Get the field name
// Get its current value
var currentVal = parseInt(document.getElementById("txtChangeQuantity").value);
// If it isn't undefined or its greater than 0
// If is not undefined
if (!isNaN(currentVal)) {
if (currentVal > 19) {
// Increment
document.getElementById("txtChangeQuantity").value = 20;
$("#errmsg").html("The order limited to 20 units per purchase.").show().fadeOut(5000);
} else {
document.getElementById("txtChangeQuantity").value = currentVal + 1;
}
}
var data = $("#ddlQuantity").val();
// alert(data);
var arr = data.split('/');
var price = arr[1];
var qty = $("#txtChangeQuantity").val();
$("#txtUpdatedPrice").html(qty * price);
// AddtoCart();
}
//-------------------------------Increase Product Quantity on Product Details Page - Ends-------------------------
//----------------------------Add to cart on product details page - Starts----------------------------
function SetRDAvaillableProductDetails(sender) {
var rda;
var productId = $("#hfdProductId").val(); // $("#<%=hfdProductId.ClientID%>").val();
var pin = $("#hfdPincode").val();
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
AddToCartButton(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function AddToCartButton(sender, rda) {
var DeliveryRestriction = $("#hfdDeliveryRestriction").val(); // $("#<%=hfdDeliveryRestriction.ClientID%>").val();
var sellerProductStockId = $("#hfvSelproductStickID").val(); // $("#<%=hfvSelproductStickID.ClientID%>").val();
var productId = $("#hfdProductId").val(); // $("#<%=hfdProductId.ClientID%>").val();
var visitorId = $("#hfdVisitorId").val(); // $("#<%=hfdVisitorId.ClientID%>").val();
var quantity = $("#txtChangeQuantity").val(); // $("#<%=txtChangeQuantity.ClientID%>").val();
var comboId = 0;
var pin = $("#hfdPincode").val(); //== Pincode ==//
var RDA = rda; //== RESTRICTED DELIVERY AVAILLABLE == //
var lbtnAdd;
var lbtnAddDummy;
if (DeliveryRestriction != 0 && RDA == 0 && pin == 0) {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if (pin == 0 || pin == "") {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if (DeliveryRestriction != 0 && RDA == 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
if ($("#btnAddToCartClick").css("display") == "block") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
}
if (pin != 0 && DeliveryRestriction == 0) {
quantity = 1;
AddPlusPrimaryProductDetails(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
else if (pin != 0 && DeliveryRestriction != 0 && RDA != 0) {
quantity = 1;
AddPlusPrimaryProductDetails(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
}
//----------------------------Add to cart on product details page - Ends----------------------------
//********************************
//----------------------------Add to cart on product details page - Starts----------------------------
function SetRDAvaillableProductDetailsToCart(sender) {
var rda;
var productId = $("#hfdProductId").val(); // $("#<%=hfdProductId.ClientID%>").val();
var pin = $("#hfdPincode").val();
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
AddToCartButtonProductDetailsToCart(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function AddToCartButtonProductDetailsToCart(sender, rda) {
var DeliveryRestriction = $("#hfdDeliveryRestriction").val(); // $("#<%=hfdDeliveryRestriction.ClientID%>").val();
var sellerProductStockId = $("#hfvSelproductStickID").val(); // $("#<%=hfvSelproductStickID.ClientID%>").val();
var productId = $("#hfdProductId").val(); // $("#<%=hfdProductId.ClientID%>").val();
var visitorId = $("#hfdVisitorId").val(); // $("#<%=hfdVisitorId.ClientID%>").val();
var quantity = $("#txtChangeQuantity").val(); // $("#<%=txtChangeQuantity.ClientID%>").val();
var comboId = 0;
var pin = $("#hfdPincode").val(); //== Pincode ==//
var RDA = rda; //== RESTRICTED DELIVERY AVAILLABLE == //
var lbtnAdd;
var lbtnAddDummy;
if (DeliveryRestriction != 0 && RDA == 0 && pin == 0) {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if (pin == 0 || pin == "") {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if (DeliveryRestriction != 0 && RDA == 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if ($(sender).parent().find(".spnCheckCartPrimary").text() == 1 || $(sender).parent().find(".spnCheckCartPrimary").text() == "1") {
if ($("#btnAddToCartClick").css("display") == "block") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
}
if (pin != 0 && DeliveryRestriction == 0) {
quantity = $("#txtChangeQuantity").val();
AddPlusPrimaryProductDetails(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
else if (pin != 0 && DeliveryRestriction != 0 && RDA != 0) {
quantity = $("#txtChangeQuantity").val();
AddPlusPrimaryProductDetails(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
lbtnAdd = document.getElementById('lbtnAddTocart'); // document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
}
//----------------------------Add to cart on product details page - Ends----------------------------
//********************************
//-------------------------------Add to cart for Combo on product details page - Starts-------------------------
function SetRDAvaillableCombo(sender) {
var rda;
var productId = $("#hfdProductId").val(); //$("#<%=hfdProductId.ClientID%>").val();
var pin = $("#hfdPincode").val();
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
AddToCartCombo(sender, rda);
},
failure: function (response) {
alert(rda);
},
error: function (response) {
alert(rda);
}
});
}
function AddToCartCombo(sender, rda) {
var presellerComboId = sender.previousElementSibling.id;
var comboId = parseInt(document.getElementById(presellerComboId).value);
var DeliveryRestriction = $("#hfdDeliveryRestriction").val(); //$("#<%=hfdDeliveryRestriction.ClientID%>").val();
var sellerProductStockId = $("#hfvSelproductStickID").val(); //$("#<%=hfvSelproductStickID.ClientID%>").val();
var productId = $("#hfdProductId").val(); //$("#<%=hfdProductId.ClientID%>").val();
var visitorId = $("#hfdVisitorId").val(); //$("#<%=hfdVisitorId.ClientID%>").val();
var quantity = 1;
var pin = $("#hfdPincode").val(); //== Pincode ==//
var RDA = rda; //== RESTRICTED DELIVERY AVAILLABLE == //
var lbtnAdd;
var lbtnAddDummy;
if (DeliveryRestriction != 0 && RDA == 0 && pin == 0) {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartCombos").text() == 1 || $(sender).parent().find(".spnCheckCartCombos").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
lbtnAdd = document.getElementById('lbtnAddTocart'); //document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); //document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if (pin == 0 || pin == "") {
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartCombos").text() == 1 || $(sender).parent().find(".spnCheckCartCombos").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "none";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "block";
lbtnAdd = document.getElementById('lbtnAddTocart'); //document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); // document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if (DeliveryRestriction != 0 && RDA == 0) {
document.getElementById("Expincode").innerHTML = pin;
loadPopupBox(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
if ($(sender).parent().find(".spnCheckCartCombos").text() == 1 || $(sender).parent().find(".spnCheckCartCombos").text() == "1") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
document.getElementById("Message").style.display = "block";
document.getElementById("Check").style.display = "block";
document.getElementById("Avilability").style.display = "none";
lbtnAdd = document.getElementById('lbtnAddTocart'); //document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); //document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
if ($(sender).parent().find(".spnCheckCartCombos").text() == 1 || $(sender).parent().find(".spnCheckCartCombos").text() == "1") {
if ($("#btnAddToCartClick").css("display") == "block") {
CartConfirmation(productId, visitorId, quantity, sellerProductStockId, comboId, sender);
}
}
if (pin != 0 && DeliveryRestriction == 0) {
quantity = 1;
AddPlusPrimaryProductDetails(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
lbtnAdd = document.getElementById('lbtnAddTocart'); //document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); //document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
else if (pin != 0 && DeliveryRestriction != 0 && RDA != 0) {
quantity = 1;
AddPlusPrimaryProductDetails(visitorId, productId, quantity, sellerProductStockId, comboId, sender);
lbtnAdd = document.getElementById('lbtnAddTocart'); //document.getElementById('<%= lbtnAddTocart.ClientID %>');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy'); //document.getElementById('<%= lbtnAddTocartdummy.ClientID %>');
lbtnAddDummy.style.display = "none";
}
}
//-------------------------------Add to cart for Combo on product details page - Ends-------------------------
//-------------------------------Decrease, Increase & Directly Entered Product count on Cart - Starts-------------------------
function qtyminusClick(sender) {
document.getElementById("lblMinimumOrderLimit").innerHTML = '';
// Stop acting like a button
// Get the field name
var arr = (sender.id).split('/');
var fieldName = arr[0].replace('qtyminus', 'txtQuantity');
// Get its current value
var currentVal = parseInt(document.getElementById(fieldName).value);
if (!isNaN(currentVal) && currentVal > 1) {
// Decrement one
document.getElementById(fieldName).value = currentVal - 1;
} else {
// Otherwise put a 0 there
document.getElementById(fieldName).value = 1;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/UpdateProduct",
data: "{'id':'" + sender.id + '/' + document.getElementById(fieldName).value + "'}",
success: function (data) {
var obj = data.d;
if (data.d.length != '0' && obj[0].TotalCount != '0') {
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
var spanTotalPriceId = arr[0].replace('qtyminus', 'spnTotalPrice');
var txtQuantityId = arr[0].replace('qtyminus', 'txtQuantity');
document.getElementById(spanTotalPriceId).innerText = obj[0].CartProductDetails[0].TotalPrice;
document.getElementById(txtQuantityId).value = obj[0].CartProductDetails[0].Quantity;
document.getElementById("hdfNetTotal").value = parseInt(obj[0].NetTotal);
document.getElementById("hdfMinimumOrderLimit").value = parseInt(obj[0].MinimumOrderLimitAmount);
document.getElementById("lblSumOfCart").innerHTML = 'Net Total : ' + ' ' + (parseInt(obj[0].NetTotal) - parseInt(obj[0].Discount));
document.getElementById("lblSumOfCart").style.display = "block";
if (parseInt(obj[0].Discount) != 0) {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "block";
} else {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "none";
}
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("CartDropdown").style.display = 'block';
document.getElementById("lblEmpty").style.display = "none";
document.getElementById("viewCart").style.display = "block";
} else {
//alert("The order limited to 20000 per purchase..");
//document.getElementById(txtQuantityId).value = parseInt(document.getElementById((sender.id).split('/')[0].replace('qtyminus', 'txtQuantity')).value) - 1;
document.getElementById((sender.id).split('/')[0].replace('qtyminus', 'txtQuantity')).value = parseInt(document.getElementById((sender.id).split('/')[0].replace('qtyplus', 'txtQuantity')).value) - parseInt(1);
}
// if (data.d == 2) {
// }
// var elem = "a";
// OnMouseIn(elem);
// if (data.d == 2) {
// alert("The order limited to 20000 per purchase..");
// }
// var elem = "a";
// OnMouseIn(elem);
},
error: function (result) {
alert("Error");
}
});
}
// This button will decrement the value till 0
function qtyplusClick(sender) {
document.getElementById("lblMinimumOrderLimit").innerHTML = '';
// Stop acting like a button
// Get the field name
var arr = (sender.id).split('/');
var fieldName = arr[0].replace('qtyplus', 'txtQuantity');
// Get its current value
var currentVal = parseInt(document.getElementById(fieldName).value);
// If it isn't undefined or its greater than 0
// If is not undefined
if (!isNaN(currentVal)) {
// Increment
document.getElementById(fieldName).value = currentVal + 1;
} else {
// Otherwise put a 0 there
document.getElementById(fieldName).value = 1;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/UpdateProduct",
data: "{'id':'" + sender.id + '/' + document.getElementById(fieldName).value + "'}",
success: function (data) {
var obj = data.d;
if (data.d.length != '0' && obj[0].TotalCount != '0') {
var spanTotalPriceId = arr[0].replace('qtyplus', 'spnTotalPrice');
var txtQuantityId = arr[0].replace('qtyplus', 'txtQuantity');
document.getElementById(spanTotalPriceId).innerText = obj[0].CartProductDetails[0].TotalPrice;
document.getElementById(txtQuantityId).value = obj[0].CartProductDetails[0].Quantity;
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
document.getElementById("hdfNetTotal").value = parseInt(obj[0].NetTotal);
document.getElementById("hdfMinimumOrderLimit").value = parseInt(obj[0].MinimumOrderLimitAmount);
document.getElementById("lblSumOfCart").innerHTML = 'Net Total : ' + ' ' + (parseInt(obj[0].NetTotal) - parseInt(obj[0].Discount));
document.getElementById("lblSumOfCart").style.display = "block";
if (parseInt(obj[0].Discount) != 0) {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "block";
} else {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "none";
}
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("CartDropdown").style.display = 'block';
document.getElementById("lblEmpty").style.display = "none";
document.getElementById("viewCart").style.display = "block";
} else {
alert("The order limited to 20000 per purchase..");
document.getElementById((sender.id).split('/')[0].replace('qtyplus', 'txtQuantity')).value = parseInt(document.getElementById((sender.id).split('/')[0].replace('qtyplus', 'txtQuantity')).value) - parseInt(1);
}
// if (data.d == 2) {
// }
// var elem = "a";
// OnMouseIn(elem);
// if (data.d == 2) {
// alert("The order limited to 20000 per purchase..");
// }
// var elem = "a";
// OnMouseIn(elem);
},
error: function (result) {
alert("Error");
}
});
}
function txtQuantityblur(sender) {
document.getElementById("lblMinimumOrderLimit").innerHTML = '';
var currentVal = document.getElementById(sender.id).value;
if (currentVal < 1) {
// Increment
document.getElementById(sender.id).value = 1;
}
else if (currentVal > 20) {
// Increment
document.getElementById(sender.id).value = 20;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/UpdateProduct",
data: "{'id':'" + sender.nextElementSibling.id + '/' + document.getElementById(sender.id).value + "'}",
success: function (data) {
var obj = data.d;
if (data.d.length != '0' && obj[0].TotalCount != '0') {
var spanTotalPriceId = sender.id.replace('txtQuantity', 'spnTotalPrice');
document.getElementById(spanTotalPriceId).innerText = obj[0].CartProductDetails[0].TotalPrice;
document.getElementById(sender.id).value = obj[0].CartProductDetails[0].Quantity;
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
document.getElementById("hdfNetTotal").value = parseInt(obj[0].NetTotal);
document.getElementById("hdfMinimumOrderLimit").value = parseInt(obj[0].MinimumOrderLimitAmount);
document.getElementById("lblSumOfCart").innerHTML = 'Net Total : ' + ' ' + (parseInt(obj[0].NetTotal) - parseInt(obj[0].Discount));
document.getElementById("lblSumOfCart").style.display = "block";
if (parseInt(obj[0].Discount) != 0) {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "block";
} else {
document.getElementById("lblDiscount").innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "none";
}
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("CartDropdown").style.display = 'block';
document.getElementById("lblEmpty").style.display = "none";
document.getElementById("viewCart").style.display = "block";
} else {
alert("The order limited to 20000 per purchase..");
}
// if (data.d == 2) {
// }
// var elem = "a";
// OnMouseIn(elem);
// if (data.d == 2) {
// alert("The order limited to 20000 per purchase..");
// }
// var elem = "a";
// OnMouseIn(elem);
},
error: function (result) {
alert("Error");
}
});
}
//-------------------------------Decrease, Increase & Directly Entered Product count on Cart - Ends-------------------------
//-------------------------------Get Product Details on Buy Item page - Starts-------------------------
function GetProductDetails() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/BuyItem.aspx/LoadCartDetails",
data: "{'id':''}",
success: function (data) {
if (parseInt(data.d[0].MinimumOrderLimitAmount) < parseInt(data.d[0].NetTotal)) {
if (document.getElementById('btnPayCOD')!=null)
{
document.getElementById('btnPayCOD').disabled = false;
document.getElementById('btnPayCOD').className = "btn btn-warning margintopmfive";
}
document.getElementById('ContentPlaceHolder1_btnPayment').disabled = false;
document.getElementById('ContentPlaceHolder1_btnPayment').className = "btn btn-warning margintopmfive";
document.getElementById("ContentPlaceHolder1_lblOrderLimitMsg").innerHTML = '';
}
else {
if (document.getElementById('btnPayCOD') != null) {
document.getElementById('btnPayCOD').disabled = true;
document.getElementById('btnPayCOD').className = "btn btn-warning margintopmfive";
}
document.getElementById('ContentPlaceHolder1_btnPayment').disabled = true;
document.getElementById('ContentPlaceHolder1_btnPayment').className = "btn btn-warning margintopmfive";
document.getElementById("MaintainMinimumOrder").style.display = "block";
document.getElementById("ContentPlaceHolder1_lblOrderLimitMsg").innerHTML = 'Sorry, the minimum order amount is ' + data.d[0].MinimumOrderLimitAmount + '.';
}
// alert(data);
if (data.d[0].TotalCount != '0') {
var obj = data.d;
var outString = '';
document.getElementById("lblCartCount").innerText = obj[0].TotalCount;
var TOT = [];
for (var i = 0; i < obj[0].CartProductDetails.length; i++) {
outString += '';
restrict.style.display = "inline";
var OSD = obj[0].CartProductDetails[i].OrderSummaryDetailsId;
TOT.push(OSD);
document.getElementById('hfdFinalRemoveProductId').value = TOT;
}
else {
outString += '">';
}
outString += '';
if (obj[0].CartProductDetails[i].OfferId != 0) {
outString += ' ';
}
outString += obj[0].CartProductDetails[i].BrandName + ' - ' + obj[0].CartProductDetails[i].ProductName
+ ' '
+ ' '
+ ''
+ obj[0].CartProductDetails[i].Volume
+ ' '
+ ' ' + obj[0].CartProductDetails[i].Price
+ ' ';
if (obj[0].CartProductDetails[i].RestrictedDelivery != 0 && obj[0].CartProductDetails[i].DeliveryAvaillable == 0) {
outString += '';
}
else {
outString += ' '
+ ''
+ ' ' + obj[0].CartProductDetails[i].TotalPrice
+ ' '
}
outString += ' '
+ ' '
+ ' ';
}
document.getElementById('divgvItems').style.display = "block";
document.getElementById('divgvItems').innerHTML = '' +
'Items Quantity Volume ' +
'Item Price Sub Total Remove ' +
' ' + outString + '
';
document.getElementById("lblSumOfCart").innerHTML = 'Net Total : ' + parseInt(obj[0].NetTotal);
document.getElementById("lblSumOfCart").style.display = "block";
if (parseInt(obj[0].RewardPrice) != 0) {
document.getElementById('lblRewardPrice').innerHTML = parseInt(obj[0].RewardPrice);
}
if (parseInt(obj[0].NetTotal) != 0) {
document.getElementById('lblNetTotal').innerHTML = parseInt(obj[0].NetTotal);
}
if (parseInt(obj[0].DeliveryCharges) != 0) {
document.getElementById('lblDeliveryCharges').innerHTML = parseInt(obj[0].DeliveryCharges);
}
if (parseInt(obj[0].FinalTotal) != 0) {
document.getElementById('lblFinalTotal').innerHTML = (parseInt(obj[0].NetTotal) + parseInt(obj[0].DeliveryCharges) - parseInt(obj[0].RewardPrice) - parseInt(obj[0].Discount));
}
if (parseInt(obj[0].Discount) != 0) {
document.getElementById('lblDiscount').innerHTML = parseInt(obj[0].Discount);
document.getElementById("divcardiscount").style.display = "block";
} else {
document.getElementById('lblDiscount').innerHTML = 0;
document.getElementById("divcardiscount").style.display = "none";
}
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("lblEmpty").style.display = "none";
document.getElementById("viewCart").style.display = "block";
} else {
//alert(data.d);
document.getElementById("viewCart").style.display = "none";
document.getElementById("menuCart").innerHTML = "";
document.getElementById("lblEmpty").innerText = "Your Cart is Empty";
document.getElementById("lblEmpty").style.float = "none";
document.getElementById("lblEmpty").style.min_width = "96px";
document.getElementById("divcardiscount").style.display = "none";
document.getElementById("menuCart").style.min_width = "100px";
document.getElementById("lblSumOfCart").style.display = "none";
document.getElementById('divgvItems').innerHTML = '';
document.getElementById("lblCartCount").innerText = '0';
document.getElementById('lblRewardPrice').innerHTML = 0;
document.getElementById('lblNetTotal').innerHTML = 0;
document.getElementById('lblDeliveryCharges').innerHTML = 0;
document.getElementById('lblFinalTotal').innerHTML = 0;
document.getElementById('lblDiscount').innerHTML = 0;
window.location = "/";
}
},
error: function (result) {
// alert("Error");
}
});
}
//-------------------------------Get Product Details on Buy Item page - Ends-------------------------
//-------------------------------Increase, decrease, directly entered product quantity,Remove product on Buy Item page - Starts-------------------------
// This button will decrement the value till 0
function qtyplusBuyProductClick(sender) {
// Stop acting like a button
// Get the field name
var arr = (sender.id).split('/');
var fieldName = arr[0].replace('qtyplus', 'txtQuantity');
// Get its current value
var currentVal = parseInt(document.getElementById(fieldName).value);
// If it isn't undefined or its greater than 0
// If is not undefined
if (!isNaN(currentVal)) {
// Increment
document.getElementById(fieldName).value = currentVal + 1;
} else {
// Otherwise put a 0 there
document.getElementById(fieldName).value = 1;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/BuyItem.aspx/UpdateProduct",
data: "{'id':'" + sender.id + '/' + document.getElementById(fieldName).value + "'}",
success: function (data) {
if (data.d == 2) {
alert("The order limited to 20000 per purchase..");
}
GetProductDetails();
},
error: function (result) {
alert("Error");
}
});
}
function qtyminusBuyProductClick(sender) {
// Stop acting like a button
// Get the field name
var arr = (sender.id).split('/');
var fieldName = arr[0].replace('qtyminus', 'txtQuantity');
// Get its current value
var currentVal = parseInt(document.getElementById(fieldName).value);
if (!isNaN(currentVal) && currentVal > 1) {
// Decrement one
document.getElementById(fieldName).value = currentVal - 1;
} else {
// Otherwise put a 0 there
document.getElementById(fieldName).value = 1;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/BuyItem.aspx/UpdateProduct",
data: "{'id':'" + sender.id + '/' + document.getElementById(fieldName).value + "'}",
success: function (data) {
if (data.d == 2) {
alert("The order limited to 20000 per purchase..");
}
GetProductDetails();
},
error: function (result) {
alert("Error");
}
});
}
function txtQuantityblurProduct(sender) {
var currentVal = document.getElementById(sender.id).value;
if (currentVal < 1) {
// Increment
document.getElementById(sender.id).value = 1;
}
else if (currentVal > 20) {
// Increment
document.getElementById(sender.id).value = 20;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/BuyItem.aspx/UpdateProduct",
data: "{'id':'" + sender.nextElementSibling.id + '/' + document.getElementById(sender.id).value + "'}",
success: function (data) {
if (data.d == 2) {
alert("The order limited to 20000 per purchase..");
}
GetProductDetails();
},
error: function (result) {
alert("Error");
}
});
}
function RemoveClickProduct(sender) {
if (confirm('Are you sure you want to Delete this Item?')) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/BuyItem.aspx/RemoveProduct",
data: "{'id':'" + sender.id + "'}",
success: function (data) {
GetProductDetails();
},
error: function (result) {
alert("Error");
}
});
}
else {
return false;
};
return false;
}
//-------------------------------Increase, decrease, directly entered product quantity,Remove product on Buy Item page - Ends-------------------------
//-------------------------------Reward Points Validate on Buy Item page - Starts-------------------------
function btnMRBRewardPointsValidate(sender) {
if ($("#txtMRBRewardPoints").val() != "") {
document.getElementById("spanMRBRewardPoints").style.display = "none";
return true;
} else
document.getElementById("spanMRBRewardPoints").style.display = "block";
return false;
}
//-------------------------------Reward Points Validate on Buy Item page - Ends-------------------------
//-------------------------------Change Address on Buy Item page - Starts-------------------------
function ChangeAddress() {
$("#NewAddress").css('display', 'none');
$("#orderConfirmation").css("display", "none");
$("#Address").css("display", "block");
$("#AddressList").css("display", "block");
}
//-------------------------------Change Address on Buy Item page - Ends-------------------------
//-------------------------------count down on Buy Item page - Ends-------------------------
function countdown(minutes) {
var seconds = 60;
var mins = minutes;
function tick() {
var counter = document.getElementById("timer");
var current_minutes = mins - 1;
seconds--;
counter.innerHTML =
current_minutes.toString() + ":" + (seconds < 10 ? "0" : "") + String(seconds);
if (seconds > 0) {
setTimeout(tick, 1000);
} else if (seconds == 0) {
// if (mins == 1) {
// countdown(mins-1); never reach “00″ issue solved:
//setTimeout(function () { countdown(mins - 1); }, 1000);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "/Home.aspx/SetCODStatus",
data: null,
success: function (data) {
window.location.href = document.location.origin + "/payu-success/";
},
error: function (result) {
alert("Error");
}
});
// }
}
}
tick();
}
//-------------------------------count down on Buy Item page - Ends-------------------------
//------------------------------------------Common Scripts for ProductList & Search Page Product Loads - Starts -------------------
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var pageIndex = 0;
var pageCount;
$(window).scroll(function () {
var Scrol = false;
var i = 650;
if ($(window).scrollTop() > 1000 && $(window).scrollTop() < 3000)
i = 750;
else if ($(window).scrollTop() > 3000 && $(window).scrollTop() < 6000)
i = 850;
if ($(window).scrollTop() + $(window).height() > $(document).height() - i) {
if (Scrol == "false") {
return false;
} else {
GetRecords();
}
}
//}
});
//Moved to page itself- by sathish
//$(function () {
// GetRecords();
//});
function GetRecords() {
var Itemid = $('#hfdItemid').val(); // $('#<%=hfdItemid.ClientID%>').val();
//var KeywordId = $('#hfdKeywordId').val(); //$('#<%=hfdKeywordId.ClientID%>').val();
var CategoryId = $('#hfdCategoryId').val(); //$('#<%=hfdCategoryId.ClientID%>').val();
//var priceRange = $('#hfdFilterByPrice').val(); //$('#<%=hfdFilterByPrice.ClientID%>').val();
var searchString = getParameterByName('q');
pageIndex++;
if (CategoryId != 0) {
if (pageIndex == 1 || pageIndex <= pageCount) {
$("#loader").show();
Scrol = "";
$.ajax({
type: "POST",
url: "/productlist.aspx/GetProductsByCategoryId",
data: '{pageIndex: ' + pageIndex + ',CategoryId: ' + CategoryId + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
},
error: function (response) {
}
});
}
}
else if (Itemid != 0) {
if (pageIndex == 1 || pageIndex <= pageCount) {
$("#loader").show();
Scrol = "";
$.ajax({
type: "POST",
url: "/productlist.aspx/GetProductListByItemId",
data: '{pageIndex: ' + pageIndex + ',Item: ' + Itemid + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
},
error: function (response) {
}
});
}
}
else if (searchString.length > 0) {
if (pageIndex == 1 || pageIndex <= pageCount) {
$("#loader").show();
Scrol = "";
$.ajax({
type: "POST",
url: "/search.aspx/GetProductsByKeyword",
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ pageIndex: pageIndex, searchString: searchString }),
dataType: "json",
success: OnSuccess,
failure: function (response) {
},
error: function (response) {
}
});
}
}
// else if (KeywordId != 0) {
// if (pageIndex == 1 || pageIndex <= pageCount) {
// $("#loader").show();
// Scrol = "";
// $.ajax({
// type: "POST",
// url: "/productlist.aspx/GetProductsByKeyword",
// dataType: "json",
// data: '{pageIndex: ' + pageIndex + ',Keyword: ' + KeywordId + '}',
// contentType: "application/json; charset=utf-8",
// success: OnSuccess,
// failure: function (response) {
// },
// error: function (response) {
// }
// });
// }
// }
// else if (priceRange != 0) {
// if (pageIndex == 1 || pageIndex <= pageCount) {
// $("#loader").show();
// Scrol = "false";
// $.ajax({
// type: "POST",
// url: "/productlist.aspx/GetProductsByFilterPriceRange",
// dataType: "json",
// data: JSON.stringify({ pageIndex1: pageIndex, ItemId1: Itemid, priceRange1: priceRange }),
// contentType: "application/json; charset=utf-8",
// success: OnSuccess,
// failure: function (response) {
// },
// error: function (response) {
// }
// });
// }
// }
}
function OnSuccess(response) {
$('.loadingdiv').show();
var arrImagePath = [
"http://cdn1.myrightbuy.com/images",
"http://cdn2.myrightbuy.com/images",
"http://cdn3.myrightbuy.com/images"
];
var ImagePath = $('#hfdImagePath').val(); // $('#<%=hfdImagePath.ClientID%>').val();
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
var images = xml.find("Images");
var volumeandquantity = xml.find("VolumeandQuantity");
var repeatColumns;
if (window.matchMedia("(min-width: 240px) and (max-width: 767px)").matches) {
repeatColumns = 1;
}
else if (window.matchMedia("(min-width: 768px) and (max-width: 1200px)").matches) {
repeatColumns = 2;
}
else if (window.matchMedia("(min-width: 1201px)").matches) {
repeatColumns = 3;
}
else {
// repeatColumns = parseInt("<%=dlImages.RepeatColumns == 0 ? 1 : dlImages.RepeatColumns %>"); // window width is less than 500px
}
var rowCount = Math.ceil(images.length / repeatColumns);
var j = 0;
var ProductStkId;
images.each(function () {
var image = $(this);
var row = $("[id*=dlImages] .item:last").closest("tr");
if ($(".is_used[value='1']", row).length == repeatColumns) {
row = $("[id*=dlImages] tr").eq(0).clone();
$(".is_used", row).val("0");
$(".image", row).attr("src", "");
$(".button", row).attr("href", "");
$(".loader", row).remove();
$("[id*=dlImages]").append(row);
j = 0;
} else {
row = $("[id*=dlImages] .item:last").closest("tr");
}
var cell = $(".item", row).eq(j);
$(".id", cell).html(image.find("ProductId").text());
var sltActualVolumePrice = $('#ddlActualVolumePrice', cell);
$(sltActualVolumePrice).html('');
var optActualVolumePrice = $('.optActualVolumePrice', cell);
$(optActualVolumePrice).html('');
$(optActualVolumePrice).val('');
var sltDiscountVolumePrice = $('#ddlDiscountVolumePrice', cell);
$(sltDiscountVolumePrice).html('');
var optDiscountVolumePrice = $('.optDiscountVolumePrice', cell);
$(optDiscountVolumePrice).html('');
$(optDiscountVolumePrice).val('');
var sellerproductstockidforaddtocart = "";
var veryfirstchild = "";
volumeandquantity.each(function () {
var volumequantity = $(this);
var currentProductId = image.find("ProductId").text();
var xmlProductId = volumequantity.find("ProductId").text();
if (currentProductId === xmlProductId) {
var currentbindQuantity = parseInt(volumequantity.find("CurrentQuantity").text());
if ((sltActualVolumePrice).children(":selected").val() === "" || (sltDiscountVolumePrice).children(":selected").val() === "" || (sltActualVolumePrice).children(":selected").val() === undefined || (sltDiscountVolumePrice).children(":selected").val() === undefined) {
$(sltActualVolumePrice).append("" + "₹ " + volumequantity.find("pricevolume").text() + " ");
$(sltDiscountVolumePrice).append("" + "₹ " + volumequantity.find("discountpricevolume").text() + " ");
if ($(sltActualVolumePrice).val() != null) {
veryfirstchild = parseInt($(sltActualVolumePrice).val().split('|')[4]);
}
} else {
if (veryfirstchild > 0) {
if (currentbindQuantity > 0) {
$(sltActualVolumePrice).append("" + "₹ " + volumequantity.find("pricevolume").text() + " ");
$(sltDiscountVolumePrice).append("" + "₹ " + volumequantity.find("discountpricevolume").text() + " ");
}
} else {
$(sltActualVolumePrice).append("" + "₹ " + volumequantity.find("pricevolume").text() + " ");
$(sltDiscountVolumePrice).append("" + "₹ " + volumequantity.find("discountpricevolume").text() + " ");
}
}
}
});
$(".Sid", cell).html(image.find("SellerProductStockId").text());
if (image.find("TamilProductName").text() != null && image.find("TamilProductName").text() != "")
$(".name", cell).html(image.find("ProductName").text() + " [" +image.find("TamilProductName").text()+"] <\span>");
else
$(".name", cell).html(image.find("ProductName").text());
//$(".name", cell).html(image.find("ProductName").text());
//$(".name", cell).html(image.find("TamilProductName").text());
//commented by logan for tamilname change
//$(".name", cell).html(image.find("ProductName").text());
$(".name", cell).css("line-height", "initial");
$(".name", cell).css("height", "45px");
$(".dlmtop", cell).css("margin-top", "12%");
var isDiscount = image.find("IsDiscountAvailable").text();
if (isDiscount != null && isDiscount != "") {
$(".divprice", cell).css("display", "block");
$(".pad5", cell).css("padding-right", "18%");
// $(".discount", cell).css("padding-left", "5%");
$(".dlmtop", cell).css("margin-top", "22%");
$(".productqty", cell).css("font-size", "17px");
$(".offer", cell).css("display", "Block");
$("#oldprice", cell).css("display", "block");
$(".oldprice", cell).css("line-height", "inherit");
$(".oldprice", cell).css("padding-right", "8%");
$(".discountpercent", cell).html(image.find("DiscountPercent").text());
$("#oldprice", cell).addClass("price-old");
$(".discount", cell).html(image.find("Price").text());
$(".price", cell).html(image.find("OriginalPrice").text());
$(".actualprice", cell).css("display", "none");
} else {
$(".actualprice", cell).css("display", "block");
$(".divprice", cell).css("display", "none");
$(".offer", cell).css("display", "none");
$("#oldprice", cell).css("display", "none");
$(".discount", cell).html(image.find("Price").text());
}
var Stock = image.find("CurrentQuantity").text();
if (Stock != null && Stock != "" && Stock != "0") {
$(".lblbtnCart", cell).show();
$(".Stck", cell).css("display", "none");
}
else {
$(".lblbtnCart", cell).css("display", "none");
$(".Stck", cell).css("display", "block");
}
$(".Volume", cell).html(image.find("Volume").text());
$(".button", cell).attr("onclick", "javascript:location.href='" + "/" + image.find("ProductName").text().replace(/ /g, "-") + '/p/' + image.find("ProductId").text() + "/" + "'");
$(".lblbtnCart", cell).attr("id", image.find("SellerProductStockId").text() + "&&" + image.find("ProductId").text() + "&&" + image.find("RestrictedDelivery").text());
$(".is_used", cell).attr("value", "1");
$(".ddlVolume", cell).css("display", "Block");
var img = $(".image", cell);
var loader = $(" ");
img.after(loader);
img.hide();
var imgIndex = Math.round(Math.random() * 3);
if (imgIndex < 0) imgIndex = 0;
if (imgIndex > 2) imgIndex = 2;
img.attr("src", arrImagePath[imgIndex] + image.find("ImageName").text().replace("Thumb", "mob"));
img.attr("onclick", "javascript:location.href='" + "/" + image.find("ProductName").text().replace(/ /g, "-") + '/p/' + image.find("ProductId").text() + "/" + "'");
$(".newtablink", cell).attr("href", "/" + image.find("ProductName").text().replace(/ /g, "-") + '/p/' + image.find("ProductId").text() + "/");
img.load(function () {
$(this).parent().find(".loader").remove();
$(this).fadeIn();
});
j++;
});
$("[id*=dlImages] .is_used[value='0']").closest(".item").remove();
HideEmptydiv();
$('#dlImages').show();
$('.loadingdiv').hide();
$('.productContainer').show();
HideEmptyimgdiv();
}
function HideEmptydiv() {
$('.productContainer').filter(function () {
return $.trim($(this).text()) === '';
}).hide();
}
function HideEmptyimgdiv() {
$('.productContainer').filter(function () {
return $.trim($(this).find('img').attr("src")) === '';
}).hide();
}
//------------------------------------------Common Scripts for ProductList & Search Page Product Loads - Ends -------------------
//********************************************* All document.ready function Starts *************************************************
$(document).ready(function () {
//------------------------------------------Calculate Window width and Height while window resize - Starts -------------------
window.onresize = function(event) {
SetWidthHeight();
}
function SetWidthHeight() {
var height = window.innerHeight;
var width = window.innerWidth;
$.ajax({
url: "/UserControls/windowSize.ashx",
data: {
'Height': height,
'Width': width
},
contentType: "application/json; charset=utf-8",
dataType: "json"
});
// .done(function (data) {
// if (data.isFirst) {
// window.location.reload();
// };
// }).fail(function (xhr) {
// //alert("Problem to retrieve browser size.");
// });
}
$(function () {
SetWidthHeight();
});
//------------------------------------------Calculate Window width and Height while window resize - Ends -------------------
//------------------------------------------Mobie View Filter Default closed - Starts -------------------
if (window.matchMedia("(max-width: 1200px)").matches) {
$('.list-group').toggle();
$('.down-arrow').css('display', 'block');
$('.up-arrow').css('display', 'none');
$('.side-heading-after').css('margin-bottom', '15px');
$('.list-group1').toggle();
$('.down-arrow1').css('display', 'block');
$('.up-arrow1').css('display', 'none');
$('.side-heading-after1').css('margin-bottom', '15px');
}
//------------------------------------------Mobie View Filter Default closed - Ends -------------------
//------------------------------------------Common Scripts for ProductList & Search Page down and up arrows - Starts -------------------
$('.down-arrow').click(function () {
//alert("t");
$('.list-group').toggle();
$('.up-arrow').css('display', 'block');
$('.down-arrow').css('display', 'none');
$('.side-heading-after').css('margin-bottom', '0px');
});
$('.up-arrow').click(function () {
//alert("t");
$('.list-group').toggle();
$('.down-arrow').css('display', 'block');
$('.up-arrow').css('display', 'none');
$('.side-heading-after').css('margin-bottom', '15px');
});
$('.down-arrow1').click(function () {
//alert("t");
$('.list-group1').toggle();
$('.up-arrow1').css('display', 'block');
$('.down-arrow1').css('display', 'none');
$('.side-heading-after1').css('margin-bottom', '0px');
});
$('.up-arrow1').click(function () {
//alert("t");
$('.list-group1').toggle();
$('.down-arrow1').css('display', 'block');
$('.up-arrow1').css('display', 'none');
$('.side-heading-after1').css('margin-bottom', '15px');
});
//------------------------------------------Common Scripts for ProductList & Search Page down and up arrows - Ends -------------------
// var wrap = $("#divUnique");
// wrap.on("scroll", function (e) {
// if (this.scrollTop > 31) {
// wrap.addClass("fix-search");
// } else {
// wrap.removeClass("fix-search");
// }
// });
// if (window.matchMedia("(min-width: 1201px)").matches) {
// // Create a clone of the menu, right next to original.
// $('.logonavheader').addClass('original').clone().insertAfter('.logonavheader').addClass('cloned').css('position', 'fixed').css('top', '0').css('margin-top', '0').css('z-index', '500').removeClass('original').hide();
// scrollIntervalID = setInterval(stickIt, 10);
// function stickIt() {
// var orgElementPos = $('.original').offset();
// orgElementTop = orgElementPos.top;
// if ($(window).scrollTop() > 0) {
// $('#header-area').addClass('first-height');
// $('#header-area').removeClass('second-height');
// } else {
// $('#header-area').addClass('second-height');
// $('#header-area').removeClass('first-height');
// }
// if ($(window).scrollTop() >= (orgElementTop)) {
// // scrolled past the original position; now only show the cloned, sticky element.
//// Cloned element should always have same left position and width as original element.
// orgElement = $('.original');
// coordsOrgElement = orgElement.offset();
// leftOrgElement = coordsOrgElement.left;
// widthOrgElement = orgElement.css('width');
// $('.cloned').css('left', leftOrgElement + 'px').css('top', 0).css('width', widthOrgElement).show();
// $('.original').css('visibility', 'hidden');
// } else {
// // not scrolled past the menu; only show the original menu.
// //$('#header-area').css('height', '121px !important');
// $('.cloned').hide();
// $('.original').css('visibility', 'visible');
// }
// }
// }
if (window.matchMedia("(min-width: 1201px)").matches) {
jQuery(window).scroll(function() {
if ($(window).scrollTop() > 0) {
$('#header-area').css('position', 'fixed');
$('.logonavheader').css('position', 'initial');
} else {
$('#header-area').css('position', 'static');
$('.logonavheader').css('position', 'static');
}
});
} else {
$('#header-area').css('position', 'static');
$('.logonavheader').css('position', 'static');
}
//----------------------Navigation dropdown click - Starts----------------------------------
if ($(window).width() > 768) {
$('.dropdown').click(function () {
window.location.href = $("a", this).attr('href');
});
}
//------------------------Navigation dropdown click - Ends--------------------------------
//------------------------Pincode popup box open & close - Starts--------------------------------
// When site loaded, load the Popupbox First
$('#popupBoxClose').click(function () {
unloadPopupBox();
});
$('#overlay').click(function () {
unloadPopupBox();
});
function unloadPopupBox() { // TO Unload the Popupbox
$("#overlay").hide();
$('#popup_box').fadeOut("slow");
}
function loadPopupBox() { // To Load the Popupbox
$('#popup_box').fadeIn("slow");
$("#overlay").show();
}
//------------------------Pincode popup box open & close - Ends--------------------------------
//------------------------Message Display alert popup - Starts--------------------------------
setTimeout(function () {
$("#divMessageDisplay").fadeOut("slow");
}, 20000); //10000 equals 8 seconds
//------------------------Message Display alert popup - Ends--------------------------------
//------------------------Username and Cart hover(By Checking BuyItem Page) effect - Starts--------------------------------
$('#liUserName').hover(function () {
$(this).find('.dropdown-menu').first().stop(true, true).slideDown(150);
}, function () {
$(this).find('.dropdown-menu').first().stop(true, true).slideUp(105);
});
var currentURLFinder = $(location).attr('href');
if (currentURLFinder.match("/buy/")) {
// $('#CartDropdown').css("display", "none");
$('#cartddlShowCart').removeAttr('onmouseenter');
$('#cartddlShowCart').css("cursor", "auto");
} else {
//$('#CartDropdown').css("display", "block");
$(this).find('.dropdown-menu').first().stop(true, true).slideUp(105);
}
$('#licart').hover(function () {
if (currentURLFinder.match("/buy/")) {
//$('#CartDropdown').css("display", "none");
$('#cartddlShowCart').removeAttr('onmouseenter');
$('#cartddlShowCart').css("cursor", "auto");
} else {
$(this).find('.dropdown-menu').first().stop(true, true).slideDown(150);
}
}, function () {
if (currentURLFinder.match("/buy/")) {
//$('#CartDropdown').css("display", "none");
$('#cartddlShowCart').removeAttr('onmouseenter');
$('#cartddlShowCart').css("cursor", "auto");
} else {
$(this).find('.dropdown-menu').first().stop(true, true).slideUp(105);
}
});
// var currentURLFinder = $(location).attr('href');
// if (currentURLFinder.match("/buy/")) {
// //$('#CartDropdown').css("display", "none");
// $('#cartddlShowCart').removeAttr('onmouseenter');
// $('#cartddlShowCart').css("cursor", "auto");
// } else {
// if ($(window).scrollTop() > 1) {
// if (window.matchMedia("(min-width: 1201px)").matches) {
// $('#CartDropdown').css("display", "block");
// } else {
// $('#CartDropdown').css("display", "none");
// }
// //$(this).find('.dropdown-menu').first().stop(true, true).slideUp(105);
// }
// }
// $('#licart').hover(
// function () {
// if (currentURLFinder.match("/buy/")) {
// $('#cartddlShowCart').removeAttr('onmouseenter');
// $('#cartddlShowCart').css("cursor", "auto");
// } else {
// if ($(window).scrollTop() > 1) {
// if (window.matchMedia("(min-width: 1201px)").matches) {
// $('#CartDropdown').css("display", "block");
// } else {
// $('#CartDropdown').css("display", "none");
// }
// //$(this).find('.dropdown-menu').first().stop(true, true).slideUp(105);
// } else {
// $('#licart').find('.dropdown-menu').first().stop(true, true).slideDown(150);
// $('#CartDropdown').css("display", "block");
// }
// }
// }, function () {
// $(this).find('.dropdown-menu').first().stop(true, true).slideUp(105);
// $('#CartDropdown').css("display", "none");
// });
// $('#licart').click(function (e) {
// if ($(window).scrollTop() > 1) {
// $("html, body").animate({
// scrollTop: 0
// }, "slow", function () {
// $('#licart').find('.dropdown-menu').first().stop(true, true).slideDown(150);
// $('#CartDropdown').css("display", "block");
// });
// return false;
// }
// });
//------------------------Username and Cart hover effect - Ends--------------------------------
//------------------------Sum of Cart or Empty Message Shows - Starts--------------------------------
var text = $("#lblSumOfCart").text(); //$("#<%=lblSumOfCart.ClientID%>").text();
if (text == "Your Cart is Empty") {
$('.menuCart').css('min-width', '100px');
} else {
$('.menuCart').css('float', 'right');
$('.menuCart').css('min-width', '280px');
}
//------------------------Sum of Cart or Empty Message Shows - Ends--------------------------------
//------------------------Recently Viewed Products - Starts--------------------------------
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
//$('#carousel2_ul li:first').before($('#carousel2_ul li:last')); //when user clicks the image for sliding right
$('#right_scroll').click(function () {
if ($('#carousel2_ul li').length > 1) {
//if ($('#carousel2_ul li:first').attr('id') !== $('#carousel2_ul li:last').attr('id')) {
//get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
var item_width = $('#carousel2_ul li').outerWidth() + 10;
//calculae the new left indent of the unordered list
var left_indent = parseInt($('#carousel2_ul').css('left')) - item_width;
//make the sliding effect using jquery's anumate function '
$('#carousel2_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
//get the first list item and put it after the last list item (that's how the infinite effects is made) '
$('#carousel2_ul li:last').after($('#carousel2_ul li:first'));
//and get the left indent to the default -210px
$('#carousel2_ul').css({ 'left': '0px' });
});
//}
} else {
// $('#carousel2_ul li:first').before($('#carousel2_ul li:last')); //when user clicks the image for sliding right
}
});
$('#left_scroll').click(function () {
if ($('#carousel2_ul li').length > 1) {
// if ($('#carousel2_ul li:first').attr('id') !== $('#carousel2_ul li:first').attr('id')) {
//when user clicks the image for sliding left
var item_width = $('#carousel2_ul li').outerWidth() + 10;
/* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */
var left_indent = parseInt($('#carousel2_ul').css('left')) + item_width;
$('#carousel2_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
/* when sliding to left we are moving the last item before the first list item */
$('#carousel2_ul li:first').before($('#carousel2_ul li:last'));
/* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */
$('#carousel2_ul').css({ 'left': '0px' });
});
} else {
// $('#carousel2_ul li:first').before($('#carousel2_ul li:first')); //when user clicks the image for sliding right
}
});
//------------------------Recently Viewed Products - Ends--------------------------------
//------------------------Recommended Products - Starts--------------------------------
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
// $('#carousel3_ul li:first').before($('#carousel3_ul li:last'));
//when user clicks the image for sliding right
$('#right_scroll1').click(function () {
if ($('#carousel3_ul li').length > 1) {
//get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
var item_width = $('#carousel3_ul li').outerWidth() + 10;
//calculae the new left indent of the unordered list
var left_indent = parseInt($('#carousel3_ul').css('left')) - item_width;
//make the sliding effect using jquery's anumate function '
$('#carousel3_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
//get the first list item and put it after the last list item (that's how the infinite effects is made) '
$('#carousel3_ul li:last').after($('#carousel3_ul li:first'));
//and get the left indent to the default -210px
$('#carousel3_ul').css({ 'left': '1px' });
});
} else {
}
});
$('#left_scroll1').click(function () {
if ($('#carousel3_ul li').length > 1) {
//when user clicks the image for sliding left
var item_width = $('#carousel3_ul li').outerWidth() + 10;
/* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */
var left_indent = parseInt($('#carousel3_ul').css('left')) + item_width;
$('#carousel3_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
/* when sliding to left we are moving the last item before the first list item */
$('#carousel3_ul li:first').before($('#carousel3_ul li:last'));
/* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */
$('#carousel3_ul').css({ 'left': '1px' });
});
} else {
}
});
//------------------------Recommended Products - Ends--------------------------------
//------------------------Goto "Top" arrow - Starts--------------------------------
var offset = 1;
var duration = 500;
jQuery(window).scroll(function () {
if (jQuery(this).scrollTop() > offset) {
jQuery('.mrb-ui-goTop').fadeIn(duration);
$('.mrb-ui-goTop').css('display', 'block');
} else {
jQuery('.mrb-ui-goTop').fadeOut(duration);
}
});
jQuery('.mrb-ui-goTop').click(function (event) {
event.preventDefault();
jQuery('html, body').animate({ scrollTop: 0 }, duration);
return false;
});
// var offset1 = 1;
// var duration1 = 500;
// jQuery(window).scroll(function () {
// if (jQuery(this).scrollTop() > offset1) {
// // if ($(window).scrollTop() > 500) {
// // $("#mrb-ui-goTop1").stop().animate({ "marginTop": ($(window).scrollTop() - $(window).scrollTop() + 500) + "px" }, "slow");
// // //alert($(window).scrollTop() - $(window).scrollTop() + 500);
// // } else {
// // $("#mrb-ui-goTop1").stop().animate({ "marginTop": ($(window).scrollTop()) + "px" }, "slow");
// // //alert($(window).scrollTop());
// // $("#mrb-ui-goTop1").stop().animate(($(window).scrollTop()) + "px" );
// // $('#mrb-ui-goTop1').fadeIn(duration1);
// // } else {
// // //jQuery('#mrb-ui-goTop1').fadeOut(duration1);
// // $('#mrb-ui-goTop1').css('display', 'block');
// // $("#mrb-ui-goTop1").removeClass("mrb-ui-goTopff");
// // $("#mrb-ui-goTop1").addClass("mtopzero");
// // }
// if (window.matchMedia("(min-width: 240px) and (max-width: 320px)").matches) {
// $('#mrb-ui-goTop1').css('display', 'block');
// $("#mrb-ui-goTop1").removeClass("mtopzero");
// $("#mrb-ui-goTop1").addClass("mrb-ui-goTopff");
// $('#mrb-ui-goTop1').css("margin-top", "318px");
// }
// if (window.matchMedia("(min-width: 321px) and (max-width: 966px)").matches) {
// $('#mrb-ui-goTop1').css('display', 'block');
// $("#mrb-ui-goTop1").removeClass("mtopzero");
// $("#mrb-ui-goTop1").addClass("mrb-ui-goTopff");
// $('#mrb-ui-goTop1').css("margin-top", "361px");
// }
// if (window.matchMedia("(min-width: 967px) and (max-width: 1200px)").matches) {
// $('#mrb-ui-goTop1').css('display', 'block');
// $("#mrb-ui-goTop1").removeClass("mtopzero");
// $("#mrb-ui-goTop1").addClass("mrb-ui-goTopff");
// $('#mrb-ui-goTop1').css("margin-top", "443px");
// }
// if (window.matchMedia("(min-width: 1201px)").matches) {
// $('#mrb-ui-goTop1').css('display', 'block');
// $("#mrb-ui-goTop1").addClass("mtopzero");
// $("#mrb-ui-goTop1").removeClass("mrb-ui-goTopff");
// //$('#mrb-ui-goTop1').css("margin-top", "488px");
// }
// } else {
// $('#mrb-ui-goTop1').css('display', 'block');
// $("#mrb-ui-goTop1").addClass("mtopzero");
// $("#mrb-ui-goTop1").removeClass("mrb-ui-goTopff");
// }
// });
//------------------------Goto "Top" arrow - Ends--------------------------------
//------------------------Mobile, Tablet, and PC Checking for Cart Header shows while Scrolling - Starts--------------------------------
// var offset2 = 1;
if (window.matchMedia("(min-width: 240px) and (max-width: 320px)").matches) {
$('#header-area').removeClass("forLargeScreen");
$('#header-area').addClass("forMobileHeader");
//$('.stickyheadermrb').css("padding-top", "266px");
}
if (window.matchMedia("(min-width: 321px) and (max-width: 603px)").matches) {
$('#header-area').removeClass("forLargeScreen");
$('#header-area').addClass("forMobileHeader");
//$('.stickyheadermrb').css("padding-top", "253px");
}
if (window.matchMedia("(min-width: 604px) and (max-width: 768px)").matches) {
$('#header-area').removeClass("forLargeScreen");
$('#header-area').addClass("forMobileHeader");
//$('.stickyheadermrb').css("padding-top", "198px");
}
if (window.matchMedia("(min-width: 769px) and (max-width: 966px)").matches) {
//$('.stickyheadermrb').css("padding-top", "220px");
$('#main-menu').addClass("mtopone");
}
if (window.matchMedia("(min-width: 967px) and (max-width: 1024px)").matches) {
//$('.stickyheadermrb').css("padding-top", "144px");
$('#main-menu').addClass("mtopone");
}
if (window.matchMedia("(min-width: 1025px) and (max-width: 1200px)").matches) {
//$('.stickyheadermrb').css("padding-top", "145px");
$('#main-menu').addClass("mtopone");
}
// if (window.matchMedia("(min-width: 1025px) and (max-width: 1200px)").matches) {
// jQuery(window).scroll(function () {
// if (jQuery(this).scrollTop() > offset2) {
// //$('.stickyheadermrb').css("padding-top", "180px");
// $('#main-menu').addClass("mtopone");
// $('#search-block').addClass("sticky-search-width");
// $('#search-block').removeClass("sticky-search-width-remove");
// $('#licart').addClass("sticky-search-width");
// $('#licart').removeClass("sticky-search-width-remove");
// } else {
// //$('.stickyheadermrb').css("padding-top", "157px");
// $('#main-menu').addClass("mtopone");
// $('#search-block').removeClass("sticky-search-width");
// $('#search-block').removeClass("sticky-search-width-remove");
// $('#licart').removeClass("sticky-search-width");
// $('#licart').removeClass("sticky-search-width-remove");
// }
// });
// }
// if (window.matchMedia("(min-width: 1201px)").matches) {
// jQuery(window).scroll(function () {
// if (jQuery(this).scrollTop() > offset2) {
// // $('.stickyheadermrb').css("padding-top", "180px");
// $('#main-menu').addClass("mtopone");
// $('#search-block').addClass("sticky-search-width");
// $('#search-block').removeClass("sticky-search-width-remove");
// $('#licart').addClass("sticky-search-width");
// $('#licart').removeClass("sticky-search-width-remove");
// } else {
// //$('.stickyheadermrb').css("padding-top", "180px");
// $('#main-menu').addClass("mtopone");
// $('#search-block').removeClass("sticky-search-width");
// $('#search-block').removeClass("sticky-search-width-remove");
// $('#licart').removeClass("sticky-search-width");
// $('#licart').removeClass("sticky-search-width-remove");
// }
// });
// }
// else {
// }
//------------------------Mobile, Tablet, and PC Checking for Cart Header shows while Scrolling - Ends--------------------------------
//------------------------Cart Header shows while Scrolling - Starts--------------------------------
jQuery(window).scroll(function () {
if (jQuery(this).scrollTop() > 0) {
jQuery('.header-top').css('display', 'none');
} else {
jQuery('.header-top').css('display', 'block');
}
});
//------------------------Cart Header shows while Scrolling - Ends--------------------------------
//------------------------Special Products Slide - Starts--------------------------------
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
$('#carousel4_ul li:first').before($('#carousel4_ul li:last'));
//when user clicks the image for sliding right
$('#right_scroll2').click(function () {
//get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
var item_width = $('#carousel4_ul li').outerWidth() + 10;
//calculae the new left indent of the unordered list
var left_indent = parseInt($('#carousel4_ul').css('left')) - item_width;
//make the sliding effect using jquery's anumate function '
$('#carousel4_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
//get the first list item and put it after the last list item (that's how the infinite effects is made) '
$('#carousel4_ul li:last').after($('#carousel4_ul li:first'));
//and get the left indent to the default -210px
$('#carousel4_ul').css({ 'left': '3px' });
});
});
//when user clicks the image for sliding left
$('#left_scroll2').click(function () {
var item_width = $('#carousel4_ul li').outerWidth() + 10;
/* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */
var left_indent = parseInt($('#carousel4_ul').css('left')) + item_width;
$('#carousel4_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
/* when sliding to left we are moving the last item before the first list item */
$('#carousel4_ul li:first').before($('#carousel4_ul li:last'));
/* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */
$('#carousel4_ul').css({ 'left': '3px' });
});
});
//------------------------Special Products Slide - Ends--------------------------------
//------------------------Latest Products Slide - Starts--------------------------------
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
$('#carousel5_ul li:first').before($('#carousel5_ul li:last'));
//when user clicks the image for sliding right
$('#right_scroll3').click(function () {
//get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
var item_width = $('#carousel5_ul li').outerWidth() + 10;
//calculae the new left indent of the unordered list
var left_indent = parseInt($('#carousel5_ul').css('left')) - item_width;
//make the sliding effect using jquery's anumate function '
$('#carousel5_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
//get the first list item and put it after the last list item (that's how the infinite effects is made) '
$('#carousel5_ul li:last').after($('#carousel5_ul li:first'));
//and get the left indent to the default -210px
$('#carousel5_ul').css({ 'left': '3px' });
});
});
//when user clicks the image for sliding left
$('#left_scroll3').click(function () {
var item_width = $('#carousel5_ul li').outerWidth() + 10;
/* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */
var left_indent = parseInt($('#carousel5_ul').css('left')) + item_width;
$('#carousel5_ul:not(:animated)').animate({ 'left': left_indent }, 10, function () {
/* when sliding to left we are moving the last item before the first list item */
$('#carousel5_ul li:first').before($('#carousel5_ul li:last'));
/* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */
$('#carousel5_ul').css({ 'left': '3px' });
});
});
//------------------------Latest Products Slide - Ends--------------------------------
//------------------------Click On small Image to show on product details page - Starts--------------------------------
$('.smallImage img').click(function () {
var i = $(this).attr('src');
var Im = i.replace("_Thumb", "");
var Img = Im.replace("_thumb", "");
//$("#<%=imgProduct.ClientID%>").attr('src', Img);
$("#imgProduct").attr('src', Img);
$('.zoomImg').attr('src', Img);
});
//------------------------Click On small Image to show on product details page - Ends--------------------------------
//------------------------Check dummy buy now button - Starts--------------------------------
var lbtnAdd;
var lbtnAddDummy;
var rda;
var productId = $("#hfdProductId").val(); //$("#<%=hfdProductId.ClientID%>").val();
var pin = $("#hfdPincode").val();
if (pin.length > 5 && productId != null && productId.length > 0) {
$.ajax({
type: "POST",
url: "/Home.aspx/CheckPincode",
dataType: "json",
data: JSON.stringify({ Pincode: pin, ProductId: productId }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (response) {
rda = parseInt((response.d).split(':')[2]);
CheckPincodeforBuy(rda);
},
failure: function (response) {
//alert(rda);
},
error: function (response) {
//alert(rda);
}
});
}
function CheckPincodeforBuy(rda) {
var DeliveryRestriction = parseInt($("#hfdDeliveryRestriction").val()); // $("#<%=hfdDeliveryRestriction.ClientID%>").val();
var pin = parseInt($("#hfdPincode").val()); //== Pincode ==//
var RDA = rda; //== RESTRICTED DELIVERY AVAILLABLE == //
if (pin != 0 && DeliveryRestriction == 0) {
lbtnAdd = document.getElementById('lbtnAddTocart');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy');
lbtnAddDummy.style.display = "none";
}
else if (pin != 0 && DeliveryRestriction != 0 && RDA != 0) {
lbtnAdd = document.getElementById('lbtnAddTocart');
lbtnAdd.style.display = "block";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy');
lbtnAddDummy.style.display = "none";
}
else if (pin == 0 && DeliveryRestriction == 0 && RDA != 0) {
lbtnAdd = document.getElementById('lbtnAddTocart');
lbtnAdd.style.display = "none";
lbtnAddDummy = document.getElementById('lbtnAddTocartdummy');
lbtnAddDummy.style.display = "block";
}
}
//------------------------Check dummy buy now button - Ends--------------------------------
//------------------------------------------ product Description & Reviews default & Click function Starts -------------------
$("#tab-description").addClass("active");
$("#tab-ainfo").addClass("");
$("#tab-review").addClass("");
$("#description").addClass("active");
$("#info").addClass("");
$("#review").addClass("");
$('.open-tab').click(function (event) {
var tab = $(this).attr('href');
if (tab == "#tab-ainfo") {
$("#tab-description").addClass("");
$("#tab-description").removeClass("active");
$("#tab-ainfo").addClass("active");
$("#tab-review").addClass("");
$("#tab-review").removeClass("active");
$("#description").addClass("");
$("#description").removeClass("active");
$("#info").addClass("active");
$("#review").removeClass("active");
$("#review").addClass("");
} else {
$("#tab-description").addClass("");
$("#tab-description").removeClass("active");
$("#tab-review").addClass("active");
$("#tab-ainfo").addClass("");
$("#tab-ainfo").removeClass("active");
$("#description").addClass("");
$("#description").removeClass("active");
$("#review").addClass("active");
$("#info").removeClass("active");
$("#info").addClass("");
}
});
//------------------------------------------ product Description & Reviews default & Click function Ends -------------------
//------------------------------------------ Product Image Zoom Diabled funtion on product details page - Starts -------------------
if (window.matchMedia("(min-width: 240px)").matches) {
$("#ContentPlaceHolder1_imgProduct").attr('data-magnification', '0');
}
else {
$("#ContentPlaceHolder1_imgProduct").attr('data-magnification', '3');
}
//------------------------------------------ Product Image Zoom Diabled funtion on product details page - Ends -------------------
//------------------------------------------ Mouse over effect in plus minus button on product details page - Ends -------------------
$("#qtyminus").mouseover(function () {
$("#qtyminus").mouseenter(function () {
$("#qtyminus").css({ "cursor": "pointer" });
$("#qtyminus").css("background-color", "rgb(187, 187, 187)");
});
$("#qtyminus").mouseleave(function () {
$("#qtyminus").css("background-color", "white");
});
});
$("#qtyplus").mouseover(function () {
$("#qtyplus").mouseenter(function () {
$("#qtyplus").css({ "cursor": "pointer" });
$("#qtyplus").css("background-color", "rgb(187, 187, 187)");
});
$("#qtyplus").mouseleave(function () {
$("#qtyplus").css("background-color", "white");
});
});
//------------------------------------------ Mouse over effect in plus minus button on product details page - Ends -------------------
//------------------------------------------ Large Image Shows while click on Small Image on Product Details Page - Starts -------------------
$('.smallImage img').click(function () {
var i = $(this).attr('src');
var Im = i.replace("_Thumb", "");
var Img = Im.replace("_thumb", "");
$("#imgProduct").attr('src', Img);
$('.zoomImg').attr('src', Img);
});
//------------------------------------------ Large Image Shows while click on Small Image on Product Details Page - Ends -------------------
});
function btnBuyNowClick() {
if (parseInt(document.getElementById("hdfNetTotal").value) < parseInt(document.getElementById("hdfMinimumOrderLimit").value)) {
document.getElementById("lblMinimumOrderLimit").style.display = "block";
document.getElementById("lblMinimumOrderLimit").innerHTML = 'Sorry, the minimum order amount is ' + parseInt(document.getElementById("hdfMinimumOrderLimit").value) + '.';
return false;
} else {
document.getElementById("lblMinimumOrderLimit").innerHTML = '';
return true;
}
}
//********************************************* All document.ready function Starts *************************************************
//********************************************* From User.Js Content********************//
/* DropDown Menu Code Starts */
(function (e, t, n) { var r = e(); e.fn.dropdownHover = function (n) { if ("ontouchstart" in document) return this; r = r.add(this.parent()); return this.each(function () { var i = e(this), s = i.parent(), o = { delay: 500, instantlyCloseOthers: !0 }, u = { delay: e(this).data("delay"), instantlyCloseOthers: e(this).data("close-others") }, a = "show.bs.dropdown", f = "hide.bs.dropdown", l = e.extend(!0, {}, o, n, u), c; s.hover(function (e) { if (!s.hasClass("open") && !i.is(e.target)) return !0; l.instantlyCloseOthers === !0 && r.removeClass("open"); t.clearTimeout(c); s.addClass("open"); i.trigger(a) }, function () { c = t.setTimeout(function () { s.removeClass("open"); i.trigger(f) }, l.delay) }); i.hover(function () { l.instantlyCloseOthers === !0 && r.removeClass("open"); t.clearTimeout(c); s.addClass("open"); i.trigger(a) }); s.find(".dropdown-submenu").each(function () { var n = e(this), r; n.hover(function () { t.clearTimeout(r); n.children(".dropdown-menu").show(); n.siblings().children(".dropdown-menu").hide() }, function () { var e = n.children(".dropdown-menu"); r = t.setTimeout(function () { e.hide() }, l.delay) }) }) }) }; e(document).ready(function () { e('[data-hover="dropdown"]').dropdownHover() }) })(jQuery, this);
/* DropDown Menu Code Ends */
$(document).ready(function () {
setTimeout(function () {
$(".errorpanel").fadeOut("slow");
}, 2000); //10000 equals 8 seconds
});
$(document).ready(function () {
$('.bs-pagination td table').each(function (index, obj) {
convertToPagination(obj)
});
});
function convertToPagination(obj) {
var liststring = '";
var list = $(liststring);
list.find('span').parent().addClass('active');
$(obj).replaceWith(list);
}
//********************************************* End From User.Js Content********************//