total item (0)

sub total Rs.0

view cart

Shop

Thumbnail Title Price Action
Lemon Masala Lemon Masala Rs.15
baby corn cheese pizza baby corn cheese pizza Rs.110
Chicken Cheeze Pizza Chicken Cheeze Pizza Rs.140
Double Cheeze Pizza Double Cheeze Pizza Rs.140
Onion Cheeze Pizza Onion Cheeze Pizza Rs.90
Tomato Cheeze Pizza Tomato Cheeze Pizza Rs.90
Capsicum cheese pizza Capsicum cheese pizza Rs.90
Corn cheese pizza Corn cheese pizza Rs.110
Paneer Cheese Pizza Paneer Cheese Pizza Rs.130
Veg Cheese Pizza Veg Cheese Pizza Rs.100
Double cheese vada pav Double cheese vada pav Rs.80
Cheese Vada Pav Cheese Vada Pav Rs.40
User Crispy Chicken Sandwich User Crispy Chicken Sandwich Rs.80
Chocolate Sandwich Chocolate Sandwich Rs.60
Cheese Loaded Sandwich Cheese Loaded Sandwich Rs.70
Paneer Cheese Sandwich Paneer Cheese Sandwich Rs.70
corn cheese sandwich corn cheese sandwich Rs.60
veg cheese sandwich veg cheese sandwich Rs.50
Paneer Momos Paneer Momos Rs.90
Chicken Momos Chicken Momos Rs.80
Corn and Cheese Momos Corn and Cheese Momos Rs.80
Veg Momos Veg Momos Rs.60
Chicken Popcorn Chicken Popcorn Rs.80
Crispy Chicken Breast Strip Crispy Chicken Breast Strip Rs.90
Crispy Chicken Wings Crispy Chicken Wings Rs.90
Chicken Fries Burger Chicken Fries Burger Rs.90
Crispy Chicken Burger Crispy Chicken Burger Rs.110
Chicken Burger Chicken Burger Rs.90
Paneer Cheese Burger Paneer Cheese Burger Rs.110
Corn Cheese Burger Corn Cheese Burger Rs.80
Veg Fries Burger Veg Fries Burger Rs.75
Twistato with Peri Peri Twistato with Peri Peri Rs.50
Chicken Roll Chicken Roll Rs.95
Paneer Fried Roll Paneer Fried Roll Rs.85
Veg Fried Roll Veg Fried Roll Rs.70
Smiley Smiley Rs.60
Potato Wedges Fries Potato Wedges Fries Rs.60
Veg Cheeze Burger Veg Cheeze Burger Rs.70
American Salt Sprinkle Fries American Salt Sprinkle Fries Rs.60
American Peri Peri Sprinkle Fries American Peri Peri Sprinkle Fries Rs.70
Regular Salt Fries Regular Salt Fries Rs.50
Regular Peri Peri Fries Regular Peri Peri Fries Rs.60
Masala Fries Masala Fries Rs.80
Chicken Fries Chicken Fries Rs.110
chicken nuggets chicken nuggets Rs.80
cheese triangle nuggets cheese triangle nuggets Rs.60
Chilli Garlic Potato Pops Chilli Garlic Potato Pops Rs.60
Total Amout : 0
go to top
$(document).ready(function(){ $('input[name="product_size"]').on('change', function(){ updateTotalPrice(); }); $('input[name="product_option[]"]').on('change', function(){ updateTotalPrice(); }); // Event handlers for increment and decrement buttons $('.increment').on('click', function(e){ e.preventDefault() let quantity = $('#quantity'); let currentQuantity = parseFloat(quantity.val()); quantity.val(currentQuantity + 1); updateTotalPrice() }) $('.decrement').on('click', function(e){ e.preventDefault() let quantity = $('#quantity'); let currentQuantity = parseFloat(quantity.val()); if(currentQuantity > 1){ quantity.val(currentQuantity - 1); updateTotalPrice() } }) // Function to update the total price base on seelected options function updateTotalPrice() { let basePrice = parseFloat($('input[name="base_price"]').val()); let selectedSizePrice = 0; let selectedOptionsPrice = 0; let quantity = parseFloat($('#quantity').val()); // Calculate the selected size price let selectedSize = $('input[name="product_size"]:checked'); if(selectedSize.length > 0){ selectedSizePrice = parseFloat(selectedSize.data("price")); } // Calculate selected options price let selectedOptions = $('input[name="product_option[]"]:checked'); $(selectedOptions).each(function(){ selectedOptionsPrice += parseFloat($(this).data("price")); }) // Calculate the total price let totalPrice = (basePrice + selectedSizePrice + selectedOptionsPrice) * quantity; $('#total_price').text("Rs." + totalPrice); } // Add to cart function $("#modal_add_to_cart_form").on('submit', function(e){ e.preventDefault(); // Validation let selectedSize = $("input[name='product_size']"); if(selectedSize.length > 0){ if($("input[name='product_size']:checked").val() === undefined){ toastr.error('Please select a size'); console.error('Please select a size'); return; } } let formData = $(this).serialize(); $.ajax({ method: 'POST', url: 'https://sheikhscafe.com/add-to-cart', data: formData, beforeSend: function(){ $('.modal_cart_button').attr('disabled', true); $('.modal_cart_button').html(' Loading...'); }, success: function(response){ updateSidebarCart(); toastr.success(response.message); let row = $('#shop-table').find('tr[data-product-id="' + response.productId + '"]'); // Replace the tag with the quantity buttons row.find('td:last-child').html(`
`); let modalElement = document.getElementById('cartModal'); let modal = bootstrap.Modal.getInstance(modalElement); // Get the Bootstrap modal instance if (modal) { modal.hide(); // Hide the modal $(modalElement).on('hidden.bs.modal', function (e) { modal.dispose(); // Dispose of the modal instance }); } else { // Fallback in case modal instance is not found $('#cartModal').modal('hide'); } }, error: function(xhr, status, error){ let errorMessage = xhr.responseJSON.message; toastr.error(errorMessage); if (errorMessage === "Unauthenticated.") { window.location.href = "https://sheikhscafe.com/login"; } }, complete: function(){ $('.modal_cart_button').html('Add to Cart'); $('.modal_cart_button').attr('disabled', false); } }) }) var cartTotal = parseInt("0"); $('.increment').on('click', function() { let inputField = $(this).siblings(".quantity"); let currentValue = parseInt(inputField.val()); let rowId = inputField.data("id"); inputField.val(currentValue + 1); cartQtyUpdate(rowId, inputField.val(), function(response) { if (response.status === 'success') { inputField.val(response.qty); let productTotal = response.product_total; inputField.closest("tr") .find(".produt_cart_total") .text("Rs.:productTotal" .replace(":productTotal", productTotal)); cartTotal = response.cart_total; $('#subtotal').text("Rs." + cartTotal); $("#final_total").text("Rs." + response.grand_cart_total) } else if (response.status === 'error') { let errorMessage = xhr.responseJSON.message; inputField.val(response.qty); toastr.error(response.message); if (response.message === "Unauthenticated.") { window.location.href = "https://sheikhscafe.com/login"; } } }); }); $('.decrement').on('click', function() { let inputField = $(this).siblings(".quantity"); let currentValue = parseInt(inputField.val()); let rowId = inputField.data("id"); inputField.val(currentValue - 1); if (inputField.val() > 1) { cartQtyUpdate(rowId, inputField.val(), function(response) { if (response.status === 'success') { inputField.val(response.qty); let productTotal = response.product_total; inputField.closest("tr") .find(".produt_cart_total") .text("Rs.:productTotal" .replace(":productTotal", productTotal)); cartTotal = response.cart_total; $('#subtotal').text("Rs." + cartTotal); $("#final_total").text("Rs." + response.grand_cart_total) } else if (response.error === 'error') { let errorMessage = xhr.responseJSON.message; inputField.val(response.qty); toastr.error(response.message); if (errorMessage === "Unauthenticated.") { window.location.href = "https://sheikhscafe.com/login"; } } }); } }); function cartQtyUpdate(rowId, qty, callback) { $.ajax({ method: 'post', url: 'https://sheikhscafe.com/cart-update-qty', data: { 'rowId': rowId, 'qty': qty }, beforeSend: function() { showLoader(); }, success: function(response) { if (callback && typeof callback === 'function') { callback(response); } }, error: function(xhr, status, error) { let errorMessage = xhr.responseJSON.message; hideLoader(); toastr.error(errorMessage); }, complete: function() { hideLoader(); } }) } })