📁
SKYSHELL MANAGER-
🛒
PHP v7.4.33
Create Folder
Create File
Current Path:
home
/
oshofree
/
public_html
/
chbluxuries.com
/
chb_data
/
Name
Size
Permissions
Actions
📁
..
-
0755
🗑️
🔒
📄
config.php
7.06 KB
0444
🗑️
⬇️
✏️
🔒
📄
error_log
551.53 KB
0644
🗑️
⬇️
✏️
🔒
Editing: cart.js
$(document).ready(function() { function yourFunctionaddress() { var bigid = $('#orderid').val(); var city = $('#city').val(); var type = $('#delivertype').val(); var street = $('#streetaddress').val(); var suite = $('#suite').val(); var notes = $('#customernote').val(); $.ajax({ url: 'setaddress.php', data: { godid: bigid, city: city, street: street, suite: suite, notes: notes, type: type }, type: 'POST', success: function(data){ $("#saveaddress").removeAttr("disabled"); } }); } // Run the function every 10 seconds setInterval(function() { var selectedOption = $('#ship_type').val(); if (selectedOption === 'deliver') { yourFunctionaddress(); } }, 10000); $('#saveaddress').on('click', function() { $("#saveaddress").attr("disabled", "disabled"); var bigid = $('#orderid').val(); var city = $('#city').val(); var type = $('#delivertype').val(); var street = $('#streetaddress').val(); var suite = $('#suite').val(); var notes = $('#customernote').val(); $.ajax({ url: 'setaddress.php', data: { godid: bigid, city: city, street: street, suite: suite, notes: notes, type: type }, type: 'POST', success: function(data){ $("#saveaddress").removeAttr("disabled"); alert('Shipping details updated!'); } }); }); function getproTotal() { var bigid = $('#orderid').val(); $.ajax({ url: 'fetchprototal.php', type: 'POST', data: { bigid: bigid }, success: function(response) { var shippingFee = parseFloat(response); $('#product_total').text(shippingFee.toFixed(2)); if (shippingFee < 5000) { $('#ship_type option[value="within lagos"]').prop('disabled', true); $('#ship_type option[value="deliver"]').prop('disabled', true); $('#delivery_text').show(); } else { $('#ship_type option[value="within lagos"]').prop('disabled', false); $('#ship_type option[value="deliver"]').prop('disabled', false); $('#delivery_text').hide(); } }, error: function(xhr, status, error) { console.log(error); } }); } function getShipFee() { var bigid = $('#orderid').val(); $.ajax({ url: 'shippingfee.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the shipping fee on the page $('#subtotal_price').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } function getAllTotal() { var bigid = $('#orderid').val(); // Perform AJAX request to get the shipping fee $.ajax({ url: 'getalltotal.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the total price on the page $('#total_price').text(response); // Find element with class 'showTotalhere' and update its value var totalElement = $('.showTotalhere'); if (totalElement.length > 0) { totalElement.val(response); } else { console.log("Element with class 'showTotalhere' not found."); } // Find element with class 'showTotalheretext' and update its HTML var textElement = $('.showTotalheretext'); if (textElement.length > 0) { textElement.html(response); // Update HTML content } else { console.log("Element with class 'showTotalheretext' not found."); } }, error: function(xhr, status, error) { console.log(error); } }); } //run for livetime data setInterval(getAllTotal, 1000); //within lagos var input = document.getElementById('map_input'); var autocomplete = new google.maps.places.Autocomplete(input); google.maps.event.addListener(autocomplete, 'place_changed', function() { var place = autocomplete.getPlace(); // Check if a valid place is selected if (place.geometry && place.formatted_address) { var selectedAddress = place.formatted_address; var godid = $('#orderid').val(); var grams = $('#grams').val(); console.log(selectedAddress); console.log(godid); console.log(grams); $.ajax({ url: 'fetchtotal.php', method: 'POST', data: { lagos: selectedAddress, godid: godid, grams: grams }, success: function(data) { $('#total_price').html(data); getproTotal(); getallTotal(); getShipFee(); }, error: function(xhr, status, error) { // Handle error if the request fails console.log(selectedAddress); } }); } }); var inputs = document.getElementById('home_address'); var autocompletes = new google.maps.places.Autocomplete(inputs); google.maps.event.addListener(autocompletes, 'place_changed', function() { var place = autocompletes.getPlace(); if (place.geometry && place.formatted_address) { var selectedAddress = place.formatted_address; var godid = $('#orderid').val(); var grams = $('#grams').val(); console.log(selectedAddress); console.log(godid); console.log(grams); $.ajax({ url: 'homedelivery.php', method: 'POST', data: { address: selectedAddress, godid: godid, }, success: function(data) { getproTotal(); getallTotal(); getShipFee(); }, error: function(xhr, status, error) { // Handle error if the request fails console.log(selectedAddress); } }); } }); // Handle the unchecked event of the checkbox $('#homedelivery').on('change', function() { var godid = $('#orderid').val(); if (!this.checked) { $.ajax({ url: 'removehomedelivery.php', // Replace with the path to your PHP script type: 'POST', // Use POST method if required data: { godid: godid }, success: function(data) { getproTotal(); getallTotal(); getShipFee(); }, error: function(xhr, status, error) { // Handle errors, if any console.error(error); } }); } }); // Event listener for the state select element $('#stateSelect').on('change', function() { var selectedState = $(this).val(); var godid = $('#orderid').val(); var grams = $('#grams').val(); $.ajax({ url: 'fetchtotal.php', method: 'POST', data: { state: selectedState, godid: godid, grams: grams }, success: function(data) { $('#total_price').html(data); getproTotal(); getallTotal(); getShipFee(); }, error: function(xhr, status, error) { console.log(xhr.responseText); } }); }); }); $(document).ready(function() { function updateShippingDetails() { var selectedOption = $('#ship_type').val(); var statusText = document.getElementById("statusText"); var abroadText = document.getElementById("abroadText"); if (selectedOption === 'pickup') { $('#pickup_details').show(); $('#lagos_details, #delivery_details').hide(); $("#stateSelect").val(""); $("#checkout").removeAttr("disabled"); statusText.innerText,abroadText.innerText = ""; } else if (selectedOption === 'deliver') { $('#pickup_details, #lagos_details').hide(); $('#delivery_details').show(); $("#stateSelect").val(""); $("#checkout").removeAttr("disabled"); statusText.innerText,abroadText.innerText = ""; } else if (selectedOption === 'within lagos') { $('#pickup_details, #delivery_details').hide(); $('#lagos_details').show(); $("#stateSelect").val(""); $("#checkout").removeAttr("disabled"); statusText.innerText,abroadText.innerText = ""; } else if (selectedOption === 'abroad-delivery') { $('#pickup_details').hide(); $('#delivery_details').hide(); $('#lagos_details').hide(); $("#stateSelect").val(""); $("#checkout").removeAttr("disabled"); abroadText.innerText = "Please note that you will be contacted about the specifics of your location for your delivery fee to be calculated!"; } else { $('#pickup_details, #delivery_details, #lagos_details').hide(); $("#stateSelect").val(""); $("#checkout").attr("disabled", "disabled"); statusText.innerText = "Please choose a shipping type to proceed!"; abroadText.innerText = ""; } } updateShippingDetails(); function disableChcekout() { var selectedOption = $('#ship_type').val(); var statusText = document.getElementById("statusText"); updateShippingDetails(); } function getproTotal() { var bigid = $('#orderid').val(); $.ajax({ url: 'fetchprototal.php', type: 'POST', data: { bigid: bigid }, success: function(response) { var shippingFee = parseFloat(response); $('#product_total').text(shippingFee.toFixed(2)); // Check if the shipping fee is less than 5000 if (shippingFee < 5000) { // Disable the options and show the text $('#ship_type option[value="within lagos"]').prop('disabled', true); $('#ship_type option[value="deliver"]').prop('disabled', true); $('#delivery_text').show(); } else { // Enable the options and hide the text $('#ship_type option[value="within lagos"]').prop('disabled', false); $('#ship_type option[value="deliver"]').prop('disabled', false); $('#delivery_text').hide(); } }, error: function(xhr, status, error) { console.log(error); } }); } function getShipFee() { var bigid = $('#orderid').val(); $.ajax({ url: 'shippingfee.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the shipping fee on the page $('#subtotal_price').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } function getallTotal() { var bigid = $('#orderid').val(); $.ajax({ url: 'getalltotal.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the shipping fee on the page $('#total_price').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } // Listen for the change event of the dropdown $('#ship_type').on('change', function() { var selectedOption = $(this).val(); var godid = $('#orderid').val(); $.ajax({ url: 'option.php', method: 'POST', data: { option: selectedOption, godid: godid }, success: function(data) { getproTotal(); getallTotal(); getShipFee(); document.getElementById('map_input').value = ''; }, error: function(xhr, status, error) { console.log(xhr.responseText); } }); updateShippingDetails(); }); }); $(document).ready(function() { $(document).on('click', '.auto-cartbtn', function() { function checkOut() { var bigid = $('#orderid').val() $.ajax({ url: 'fetchprototal.php', type: 'POST', data: { bigid: bigid }, success: function(data) { if (data === '0') { $('#checkout').prop('disabled', true); $('#checkout_text').css('display', 'block'); } else { $('#checkout').prop('disabled', false); $('#checkout_text').css('display', 'none'); }} }); } function getproTotal() { var bigid = $('#orderid').val(); $.ajax({ url: 'fetchprototal.php', type: 'POST', data: { bigid: bigid }, success: function(response) { var shippingFee = parseFloat(response); $('#product_total').text(shippingFee.toFixed(2)); // Check if the shipping fee is less than 5000 if (shippingFee < 5000) { // Disable the options and show the text $('#ship_type option[value="within lagos"]').prop('disabled', true); $('#ship_type option[value="deliver"]').prop('disabled', true); $('#delivery_text').show(); } else { // Enable the options and hide the text $('#ship_type option[value="within lagos"]').prop('disabled', false); $('#ship_type option[value="deliver"]').prop('disabled', false); $('#delivery_text').hide(); } }, error: function(xhr, status, error) { console.log(error); } }); } function getShipFee() { var bigid = $('#orderid').val(); $.ajax({ url: 'shippingfee.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the shipping fee on the page $('#subtotal_price').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } getShipFee(); setInterval(getShipFee, 1000); function getallTotal() { var bigid = $('#orderid').val(); $.ajax({ url: 'getalltotal.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the shipping fee on the page $('#total_price').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } function getallGrams() { var bigid = $('#orderid').val(); $.ajax({ url: 'fetchgrams.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the weight on the page $('#product_weight').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } $(".auto-cartbtn").attr("disabled", "disabled"); var form = $(this).closest('form'); var bigid = $('#orderid').val(); var verify = $('#wholesaler').val(); var itemid = form.find('input[name="itemid"]').val(); var item = form.find('input[name="item"]').val(); var color = form.find('input[name="color"]').val(); var quantity = form.find('input[name="quantity"]').val(); $.ajax({ url: 'addquantity.php', data: { bigid: bigid, itemid: itemid, item: item, color: color, verify: verify, quantity: quantity }, type: 'POST', success: function(data) { $(".auto-cartbtn").removeAttr("disabled"); $('#fade-background').addClass('hidden'); $('#cart_items').html(data); getproTotal(); getallTotal(); getallGrams(); getShipFee(); disableChcekout(); checkOut(); } }); }); });
💾 Save Changes