master
parent
16b673b69e
commit
ae203f8853
|
@ -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+`<svg style="fill: white; width: 12px; margin-left: 3px; margin-bottom: 2px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M352 128C352 57.42 294.579 0 224 0 153.42 0 96 57.42 96 128H0v304c0 44.183 35.817 80 80 80h288c44.183 0 80-35.817 80-80V128h-96zM224 48c44.112 0 80 35.888 80 80H144c0-44.112 35.888-80 80-80zm176 384c0 17.645-14.355 32-32 32H80c-17.645 0-32-14.355-32-32V176h48v40c0 13.255 10.745 24 24 24s24-10.745 24-24v-40h160v40c0 13.255 10.745 24 24 24s24-10.745 24-24v-40h48v256z"/></svg>`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +179,6 @@
|
|||
let index = objProducts.indexOf(objProductInfo);
|
||||
if(index == -1) objProducts.push({id: productId, quantity: 1});
|
||||
updateProductsInLocalStorage();
|
||||
//<svg style="fill: white; width: 12px; margin-left: 3px; margin-bottom: 2px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M352 128C352 57.42 294.579 0 224 0 153.42 0 96 57.42 96 128H0v304c0 44.183 35.817 80 80 80h288c44.183 0 80-35.817 80-80V128h-96zM224 48c44.112 0 80 35.888 80 80H144c0-44.112 35.888-80 80-80zm176 384c0 17.645-14.355 32-32 32H80c-17.645 0-32-14.355-32-32V176h48v40c0 13.255 10.745 24 24 24s24-10.745 24-24v-40h160v40c0 13.255 10.745 24 24 24s24-10.745 24-24v-40h48v256z"/></svg>
|
||||
}
|
||||
$(window).on('load', function(){
|
||||
if(localStorage.getItem("dismiss-message") == 1) $('.alert-dismissible').remove();
|
||||
|
|
Loading…
Reference in New Issue