empty cart
parent
7c0254153c
commit
16b673b69e
|
@ -56,10 +56,7 @@
|
||||||
</button>
|
</button>
|
||||||
<button style="display: none;" id="btn-show-bag" type="button" data-bs-toggle="modal" data-bs-target="#ShoppingCart" class="btn btn-outline-success position-relative mb-5">
|
<button style="display: none;" id="btn-show-bag" type="button" data-bs-toggle="modal" data-bs-target="#ShoppingCart" class="btn btn-outline-success position-relative mb-5">
|
||||||
Im Warenkorb ansehen
|
Im Warenkorb ansehen
|
||||||
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
|
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" id="count-items-in-bag"></span>
|
||||||
99<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>
|
|
||||||
<span class="visually-hidden">unread messages</span>
|
|
||||||
</span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: none;" class="col-12 col-md-6">
|
<div style="display: none;" class="col-12 col-md-6">
|
||||||
|
|
|
@ -55,12 +55,15 @@
|
||||||
<div class="modal-header" style="background-color: #546c8a; color: white;">
|
<div class="modal-header" style="background-color: #546c8a; color: white;">
|
||||||
<h5 class="modal-title" id="exampleModalLabel">
|
<h5 class="modal-title" id="exampleModalLabel">
|
||||||
<svg style="fill: currentColor; width: 19px; margin-right: 8px;" 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>
|
<svg style="fill: currentColor; width: 19px; margin-right: 8px;" 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>
|
||||||
|
Warenkorb
|
||||||
Warenkorb</h5>
|
</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div style="display: none;" class="col-12" id="no-products">
|
||||||
|
<p>No Products</p>
|
||||||
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tbody id="list-products-in-bag"></tbody>
|
<tbody id="list-products-in-bag"></tbody>
|
||||||
|
@ -145,12 +148,14 @@
|
||||||
});
|
});
|
||||||
$('#total-price').text(formatter.format(totalPrice));
|
$('#total-price').text(formatter.format(totalPrice));
|
||||||
});
|
});
|
||||||
|
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').show();
|
||||||
|
$('#total-price').parent().parent().parent().show();
|
||||||
|
$('#no-products').hide();
|
||||||
}else {
|
}else {
|
||||||
$('#list-products-in-bag').html(`
|
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').hide();
|
||||||
<tr>
|
$('#total-price').parent().parent().parent().hide();
|
||||||
<td class="text-start" colspan="3"><p>keine Produkte hinzugefügt.</p></td>
|
|
||||||
</tr>`);
|
|
||||||
$('#count-products-in-bag').hide();
|
$('#count-products-in-bag').hide();
|
||||||
|
$('#no-products').show();
|
||||||
}
|
}
|
||||||
$('#total-price').text(formatter.format(totalPrice));
|
$('#total-price').text(formatter.format(totalPrice));
|
||||||
let productId = $('meta[name="product-id"]').attr('content');
|
let productId = $('meta[name="product-id"]').attr('content');
|
||||||
|
@ -172,6 +177,7 @@
|
||||||
let index = objProducts.indexOf(objProductInfo);
|
let index = objProducts.indexOf(objProductInfo);
|
||||||
if(index == -1) objProducts.push({id: productId, quantity: 1});
|
if(index == -1) objProducts.push({id: productId, quantity: 1});
|
||||||
updateProductsInLocalStorage();
|
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(){
|
$(window).on('load', function(){
|
||||||
if(localStorage.getItem("dismiss-message") == 1) $('.alert-dismissible').remove();
|
if(localStorage.getItem("dismiss-message") == 1) $('.alert-dismissible').remove();
|
||||||
|
|
Loading…
Reference in New Issue