From 3f981767f9315893e28118bbf610b1fdfd68c3e0 Mon Sep 17 00:00:00 2001 From: Gustavo Luigi <=> Date: Wed, 7 Sep 2022 15:02:32 +0200 Subject: [PATCH] . --- assets/js/checkout.js | 13 +++++++++++++ assets/js/script.js | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/assets/js/checkout.js b/assets/js/checkout.js index ecc7223..be20c43 100644 --- a/assets/js/checkout.js +++ b/assets/js/checkout.js @@ -57,6 +57,19 @@ $(window).on('load', function(){ objProducts = []; localStorage.setItem("products", JSON.stringify(objProducts)); }); + $(document).on('click', '.btn-remove-product', function(){ + if(objProducts.length > 0){ + $('#form-section').show(); + $('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').show(); + $('#total-checkout-price').parent().parent().parent().show(); + $('#no-products-in-checkout').hide(); + }else{ + $('#form-section').hide(); + $('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide(); + $('#total-checkout-price').parent().parent().parent().hide(); + $('#no-products-in-checkout').show(); + } + }); $(document).on('input', '.select-quantity', function(){ getInfoFromSelectedProduct().done(function(response, status){ totalPrice = 0; diff --git a/assets/js/script.js b/assets/js/script.js index e953f91..12031b0 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -31,12 +31,6 @@ $(window).on('load', function(){ $('#total-price').parent().parent().parent().show(); $('#no-products').hide(); $('#modal-buttons').show(); - if(typeof updateProducts === "function"){ - $('#form-section').show(); - $('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').show(); - $('#total-checkout-price').parent().parent().parent().show(); - $('#no-products-in-checkout').hide(); - } }else{ $('.cart-link').hide(); $(".btn-share").hide(); @@ -45,12 +39,6 @@ $(window).on('load', function(){ $('#total-price').parent().parent().parent().hide(); $('#no-products').show(); $('#modal-buttons').hide(); - if(typeof updateProducts === "function"){ - $('#form-section').hide(); - $('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide(); - $('#total-checkout-price').parent().parent().parent().hide(); - $('#no-products-in-checkout').show(); - } } getInfoFromSelectedProduct().done(function(response, status){