diff --git a/content/master.blade.php b/content/master.blade.php index 37d3ece..de6873d 100644 --- a/content/master.blade.php +++ b/content/master.blade.php @@ -160,7 +160,8 @@ $('#total-price').text(formatter.format(totalPrice)); let productId = $('meta[name="product-id"]').attr('content'); if(productId != undefined){ - if(objProducts.find(obj => obj.id == productId) == undefined) { + let objProductInfo = objProducts.find(obj => obj.id == productId); + if(objProductInfo == undefined) { $('#btn-add-to-bag').show(); $('#btn-show-bag').hide(); $('#btn-check-out').parent().show(); @@ -169,6 +170,7 @@ $('#btn-add-to-bag').hide(); $('#btn-show-bag').show(); $('#btn-check-out').parent().hide(); + $('#count-items-in-bag').html(objProductInfo.quantity+``); } } } @@ -177,7 +179,6 @@ let index = objProducts.indexOf(objProductInfo); if(index == -1) objProducts.push({id: productId, quantity: 1}); updateProductsInLocalStorage(); - // } $(window).on('load', function(){ if(localStorage.getItem("dismiss-message") == 1) $('.alert-dismissible').remove();