Compare commits
2 Commits
9bf7acb648
...
e83c43ab03
Author | SHA1 | Date |
---|---|---|
Gustavo Luigi | e83c43ab03 | |
Gustavo Luigi | acb1503e8d |
|
@ -35,16 +35,32 @@ function updateProducts(){
|
|||
$('#list-products').append(elementProduct);
|
||||
});
|
||||
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
|
||||
}).fail(function(response){
|
||||
$('#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').hide();
|
||||
$('#cart-error-in-checkout').show();
|
||||
});
|
||||
$('#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{
|
||||
$('#cart-error-in-checkout').hide();
|
||||
}
|
||||
else if(totalPrice > 0){
|
||||
$('#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').hide();
|
||||
$('#cart-error-in-checkout').show();
|
||||
}
|
||||
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();
|
||||
$('#cart-error-in-checkout').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,12 +76,14 @@ $(window).on('load', function(){
|
|||
let products = response.contents.map(product => {
|
||||
product = getProductInfo(product);
|
||||
product = calculatePrice(product);
|
||||
return product;
|
||||
return product.quantity+'x '+product.title+' ('+numberToEuroFormat(product.calc_preis)+')';
|
||||
});
|
||||
$('#ccart').val(JSON.stringify({"total-price": totalPrice, "products": products}));
|
||||
objProducts = [];
|
||||
localStorage.setItem("products", JSON.stringify(objProducts));
|
||||
form.unbind('submit').submit();
|
||||
let cart = products.join('\n')+"\nTotal Price: "+numberToEuroFormat(totalPrice);
|
||||
$('#ccart').val(cart);
|
||||
console.log($('form').serializeArray());
|
||||
//objProducts = [];
|
||||
//localStorage.setItem("products", JSON.stringify(objProducts));
|
||||
//form.unbind('submit').submit();
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.btn-remove-product', function(){
|
||||
|
|
|
@ -113,6 +113,15 @@ function updateProductsInLocalStorage(){
|
|||
$('#list-products-in-bag').append(elementProduct);
|
||||
});
|
||||
$('#total-price').text(numberToEuroFormat(totalPrice));
|
||||
}).fail(function(response){
|
||||
$('.cart-link').hide();
|
||||
$(".btn-share").hide();
|
||||
$('#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').hide();
|
||||
$('#cart-error').show();
|
||||
$('#modal-buttons').hide();
|
||||
});
|
||||
$('.cart-link').show();
|
||||
$(".btn-share").show();
|
||||
|
@ -120,6 +129,7 @@ function updateProductsInLocalStorage(){
|
|||
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').show();
|
||||
$('#total-price').parent().parent().parent().show();
|
||||
$('#no-products').hide();
|
||||
$('#cart-error').hide();
|
||||
$('#modal-buttons').show();
|
||||
|
||||
cartLink = window.location.origin+'/'+btoa(JSON.stringify(objProducts));
|
||||
|
@ -139,6 +149,7 @@ function updateProductsInLocalStorage(){
|
|||
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').hide();
|
||||
$('#total-price').parent().parent().parent().hide();
|
||||
$('#no-products').show();
|
||||
$('#cart-error').hide();
|
||||
$('#modal-buttons').hide();
|
||||
}
|
||||
let productId = $('meta[name="product-id"]').attr('content');
|
||||
|
|
|
@ -106,6 +106,9 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div style="display: none;" class="alert alert-danger" role="alert" id="cart-error">
|
||||
Fehler beim Laden der Produkte, versuchen Sie, die Seite neu zu laden
|
||||
</div>
|
||||
<div style="display: none;" class="col-12 text-center" id="no-products">
|
||||
|
||||
<br>
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
<!-- Calendly inline widget end -->
|
||||
</div>
|
||||
@else
|
||||
<div style="display: none;" class="alert alert-danger" role="alert" id="cart-error-in-checkout">
|
||||
Fehler beim Laden der Produkte, versuchen Sie die Seite neu zu laden
|
||||
</div>
|
||||
<div style="display: none;" class="col-12 text-center" id="no-products-in-checkout">
|
||||
<br>
|
||||
<br>
|
||||
|
|
Loading…
Reference in New Issue