diff --git a/content/master.blade.php b/content/master.blade.php
index ef7b867..2bfc3b9 100644
--- a/content/master.blade.php
+++ b/content/master.blade.php
@@ -129,6 +129,7 @@
for(let i = 0; i < quantitys.length; i++) { quantityOfProducts += Number(quantitys[i]); }
$('#count-products-in-bag').text(quantityOfProducts);
$('#list-products-in-bag').html('');
+ if(typeof updateProducts === "function") $('#list-products').html('');
totalPrice = 0;
if(objProducts.length > 0) {
let ids = objProducts.map(obj => obj.id);
@@ -158,18 +159,32 @@
${formatter.format(item.data_fields.preis)} |
`;
$('#list-products-in-bag').append(elementProduct);
+ if(typeof updateProducts === "function") $('#list-products').append(elementProduct);
});
$('#total-price').text(formatter.format(totalPrice));
+ if(typeof updateProducts === "function") $('#total-checkout-price').text(formatter.format(totalPrice));
});
$('#count-products-in-bag').show();
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').show();
$('#total-price').parent().parent().parent().show();
$('#no-products').hide();
+ 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 {
$('#count-products-in-bag').hide();
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-price').parent().parent().parent().hide();
$('#no-products').show();
+ 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();
+ }
}
$('#total-price').text(formatter.format(totalPrice));
let productId = $('meta[name="product-id"]').attr('content');
diff --git a/content/pages/checkout.blade.php b/content/pages/checkout.blade.php
index 1c0781f..87400f5 100644
--- a/content/pages/checkout.blade.php
+++ b/content/pages/checkout.blade.php
@@ -300,58 +300,13 @@
utilsScript: "{{storage('assets/libs/intl-tel-input/js/utils.min.js')}}",
});
- function updateProducts(){
- $('#list-products').html('');
- if(objProducts.length > 0) {
- let ids = objProducts.map(obj => obj.id);
- $.get($('meta[name="get-contents"]').attr('content')+"/"+ids.join(","), function(response, status){
- response.contents.forEach(function(item){
- let objProductInfo = objProducts.find(obj => obj.id == item.id);
- let elementProduct = `
-
-
-
- |
-
- ${item.title}
-
- sofort verfügbar
-
-
-
- |
- ${formatter.format(item.data_fields.preis)} |
-
`;
- $('#list-products').append(elementProduct);
- });
- $('#total-checkout-price').text(formatter.format(totalPrice));
- });
- $('#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();
- }
- }
+ function updateProducts(){}
$(window).on('load', function(){
- updateProducts();
$('#anfrage').submit(function(){
objProducts = [];
updateProductsInLocalStorage();
});
- $(document).on('click', '.btn-remove-product', function(){ updateProducts(); });
- $(document).on('change', '.select-quantity', function(){ updateProducts(); });
});
@stop