code added
Tento commit je obsažen v:
vendorováno
+37
-14
@@ -62,7 +62,7 @@ function updateCartQuantity(id,val){
|
||||
}
|
||||
|
||||
function removeCartItem(id){
|
||||
debugger;
|
||||
|
||||
let data = getCartData();
|
||||
if(!data) return;
|
||||
|
||||
@@ -105,7 +105,7 @@ function updateSummaryPriceAdd(){
|
||||
}
|
||||
|
||||
function initAddToCart(){
|
||||
debugger;
|
||||
|
||||
addEventListeners();
|
||||
|
||||
function addToCartFun(){
|
||||
@@ -116,7 +116,7 @@ debugger;
|
||||
if(!data){
|
||||
|
||||
let cartObj = {};
|
||||
debugger;
|
||||
|
||||
|
||||
cartObj[$('#skudetailitem').val()] = {
|
||||
name:$('.productname').html(),
|
||||
@@ -171,34 +171,57 @@ debugger;
|
||||
}
|
||||
|
||||
}
|
||||
debugger;
|
||||
|
||||
setLengthCart();
|
||||
|
||||
}
|
||||
|
||||
function addEventListeners(){
|
||||
$('#addtocart').html('Add to cart')
|
||||
$('#addtocart').off().click((e)=>{
|
||||
debugger
|
||||
$('#addtocart').html('Add to cart');
|
||||
$('#addtocart').removeAttr('gotocart');
|
||||
$('#addtocart').off('click').click((e)=>{
|
||||
|
||||
$('.insufficientqty').addClass('d-none');
|
||||
const qty = parseInt($('#addtocart').data('qty'));
|
||||
debugger;
|
||||
|
||||
if(parseInt($('#quantity').val())>qty){
|
||||
$('.insufficientqty').removeClass('d-none');
|
||||
return;
|
||||
}
|
||||
$('#addtocart').off().click(function (el){
|
||||
window.location.href = '/shopping-cart.html';
|
||||
// $('#addtocart').off().click(function (el){
|
||||
// window.location.href = '/shopping-cart.html';
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
addToCartFun();
|
||||
debugger;
|
||||
|
||||
toasterHelper('success',"Item added to cart","toast-top-right");
|
||||
|
||||
$('#addtocart').html('Go to cart');
|
||||
// $('#addtocart').html('Go to cart');
|
||||
// debugger;
|
||||
// $('#addtocart').attr('gotocart',1);
|
||||
});
|
||||
|
||||
// $('.quantityHTML #quantity').off('change').change(function (e){
|
||||
// let sku = $('#skudetailitem').val();
|
||||
// let data = getCartData();
|
||||
// const qty = parseInt($('#addtocart').data('qty'));
|
||||
// let isCart = $('#addtocart').attr('gotocart');
|
||||
// if(!isCart) return;
|
||||
// if(parseInt($('#quantity').val())>qty){
|
||||
// $('.insufficientqty').removeClass('d-none');
|
||||
// return;
|
||||
// }
|
||||
// if(!data[sku]){
|
||||
// return;
|
||||
// }
|
||||
|
||||
// data[sku].quantity = $('.quantityHTML #quantity').val();
|
||||
// toasterHelper("success","Your item quantity was been updated","toast-top-right")
|
||||
// setCartData(data);
|
||||
// setLengthCart();
|
||||
// })
|
||||
|
||||
$('.buynow').off('click').click(async (e)=>{
|
||||
addToCartFun();
|
||||
const res = await COOKIE_HELPER.validateToken();
|
||||
@@ -212,7 +235,7 @@ debugger;
|
||||
}
|
||||
window.location.href = '/selectdelivery.html';
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addtoCart(data){
|
||||
|
||||
vendorováno
@@ -1,6 +1,5 @@
|
||||
shoppingCartInit();
|
||||
|
||||
debugger;
|
||||
function shoppingCartInit() {
|
||||
|
||||
shoppingCartAppend();
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele