diff --git a/content/master.blade.php b/content/master.blade.php index 3d7cfe6..1828778 100644 --- a/content/master.blade.php +++ b/content/master.blade.php @@ -174,7 +174,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(); @@ -183,6 +184,7 @@ $('#btn-add-to-bag').hide(); $('#btn-show-bag').show(); $('#btn-check-out').parent().hide(); + $('#count-items-in-bag').html(objProductInfo.quantity+``); } } } @@ -191,7 +193,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();