$(function(){
setTimeout(function() {
let shoppingCartWidget = $("[data-component-shoppingcart]");
if (shoppingCartWidget.length > 0) {
let shoppingCart = init_shopping_cart();
if (!$(document).find('div#addcart_message').length) {
$('<div id="addcart_message"></div>').prependTo(shoppingCartWidget);
}
$("body").on("click", ".add-to-cart", function(event) {
event.preventDefault();
let title = $(this).data("name");
let id = $(this).data("id");
let ref_object = $(this).data("ref_object");
let price = Number($(this).data("price"));
let image = $(this).data("image");
let image_exist = image ? image : "";
let max_items = $(this).data("max_items");
let max_items_exist = max_items ? max_items : "";
if(ref_object === 'packages'){
shoppingCart.removeAllItemsFromCartByKeyVal('object', 'packages');
}
shoppingCart.addItemToCart(id, ref_object, title, price, 1,image_exist,max_items_exist);
displayCart();
});
shoppingCartWidget.find(".clear-cart").click(function() {
if (confirm('Are you sure you want to Clear the Cart?')) {
shoppingCart.clearCart();
displayCart();
}
else{
return false;
}
});
function displayCart() {
$('#shoppingcart_popup .modal-footer').show();
let cartArray = shoppingCart.listCart();
let output = "";
console.log("cartarray",cartArray);
if (cartArray.length >0) {
for(var i in cartArray) {
let min_qty_check = cartArray[i].count == 1 ? "disabled_cart_qty" : "cart_qty";
console.log("min_qty_check",min_qty_check);
output += "<tr><td data-comp-title='Table Cell' class='draggable'><div data-comp-title='Grid Row' class='row mr-0 ml-0 dropzone ui-droppable' data-htmlcomponent-type='html/gridrow'><div data-comp-title='Grid Column' class='col-lg-4 d-none text-center dropzone ui-droppable'><picture data-htmlcomponent-type='widgets/mediamanager' class='draggable' ><img data-component-mediamanager='Product Image' data-comp-title='Media Manager' src=" + cartArray[i].image + " style='mask-repeat: no-repeat;-webkit-mask-repeat: no-repeat;mask-position: 50% 50%;-webkit-mask-position: 50% 50%;mask-size: auto 100%;-webkit-mask-size: auto 100%;' data-src=" + cartArray[i].image + " data-source='LOCAL' data-license_type='FREE' data-img_id='0' width='100px' height='100px' alt='No Image' </picture></div><div data-comp-title='Grid Column' class='col-12 dropzone ui-droppable p-0' style='display: flex;align-items: center;'><span style='text-transform: uppercase; white-space: nowrap; font-size: 14px;font-weight: 600;' class='draggable service'>"+ cartArray[i].title + "</span></div></div></td>"
+ "<td data-comp-title='Table Cell' class='draggable '><div style='font-weight: 600;' class='dropzone ui-droppable'>$"+ cartArray[i].price +"</div></td>"
+ "<td data-comp-title='Table Cell' class='draggable '> <div data-comp-title='Grid Column' class='row text-center dropzone ui-droppable'><div class='container'><div class='input-group spinner'><input data-id=" + cartArray[i].id + " value=" + cartArray[i].count + " type='number' class='item-count form-control' data-comp-title='number Input' class='form-control' style='padding: 0px; width: 63px;text-align: center; height: 52px;'><div class='input-group-btn-vertical'><div data-id=" + cartArray[i].id + " class='btn btn-default plus-item'><i class='fa fa-caret-up'></i></div><div data-disabled="+min_qty_check+" data-id=" + cartArray[i].id + " class='minus-item btn btn-default'><i class='fa fa-caret-down'></i></div></div></div></div></div></td>"
+ "<td data-comp-title='Table Cell' class='draggable price'>$" + cartArray[i].total + "</td>"
+ "<td data-comp-title='Table Cell'class=' draggable ' style='text-align: center;'><div data-comp-title='Grid Column' class=''><i data-id=" + cartArray[i].id + " class='delete-item fa-close fas fa-times draggable' style='font-size: 18px;color: #a1a1a1;'></i></div></td>"
+ "</tr>";
}
}else{
output += "<tr><td colspan='5'>Your Cart is Empty...</td></tr>";
$('#shoppingcart_popup .modal-footer').hide();
}
shoppingCartWidget.find(".show-cart").html(output);
shoppingCart_totalCart=Number(shoppingCart.totalCart()).toFixed(2);
shoppingCartWidget.find(".total-cart").html(shoppingCart_totalCart);
shoppingCartWidget.find(".total-count").html(shoppingCart.totalCount());
}
shoppingCartWidget.find(".show-cart").on("click", ".delete-item", function(event) {
if (confirm('Are you sure you want to remove this item?')) {
let id = $(this).data("id");
shoppingCart.removeItemFromCartAll(id);
displayCart();
}
else{
return false;
}
});
shoppingCartWidget.find(".show-cart").on("click", ".minus-item", function(event) {
let id = $(this).data("id");
shoppingCart.removeItemFromCart(id);
displayCart();
});
shoppingCartWidget.find(".show-cart").on("click", ".plus-item", function(event) {
let id = $(this).data("id");
shoppingCart.addItemToCart(id);
displayCart();
});
displayCart();
}
}, 2000);
});
Your Cart
SERVICES
PRICE
SUBTOTAL
$789.00
Contents will be displayed here...
Page Contents Here
Make Someone
HAPPY
With
Lorem ipsum dolor sit amet, consectetur adipiscing elit.wer- Phasellus imperdiet elit velit, sed tempus ipsum elementum vitae. Proin cursus fermentum odio.
THINGS WE ARE DOING
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation