From 6160b494c9dc3f84f0ca797e0daa52af2d00d90d Mon Sep 17 00:00:00 2001 From: mark H Date: Fri, 3 May 2024 18:21:20 +0800 Subject: [PATCH] new update --- admin/config.php | 2 +- assets/js/tester11.js | 162 ++++++++++++++++++++++-------------- cart.php | 72 +++++++++++++++- checkouttest.php | 2 +- forgot_password_action.php | 2 +- header.php | 21 +++-- shop-list-left-sidebar.php | 17 ++-- user-history.php | 75 ++++++++++++----- vendor-all-product-list.php | 4 + vendor-dashboard.php | 3 +- vendor-refund-history.php | 4 +- 11 files changed, 259 insertions(+), 105 deletions(-) diff --git a/admin/config.php b/admin/config.php index d51d6b8..cb0acc2 100644 --- a/admin/config.php +++ b/admin/config.php @@ -1,6 +1,6 @@ 0) { - for (var i = 0; i < priceMatrix.length; i++) { - for (var j = 0; j < priceMatrix[i].length; j++) { - var currentQuantity = parseFloat(priceMatrix[i][j].quantity); - var nextQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity; - - if (quantityValue >= currentQuantity && quantityValue < nextQuantity) { - productPrice = parseFloat(priceMatrix[i][j].price); - foundPrice = true; - break; - } - } - if (foundPrice) { - break; - } + if (priceMatrix.length > 0) { + for (var i = 0; i < priceMatrix.length; i++) { + for (var j = 0; j < priceMatrix[i].length; j++) { + var currentQuantity = parseFloat(priceMatrix[i][j].quantity); + var nextQuantity = + j < priceMatrix[i].length - 1 + ? parseFloat(priceMatrix[i][j + 1].quantity) + : Infinity; + + if ( + quantityValue >= currentQuantity && + quantityValue < nextQuantity + ) { + productPrice = parseFloat(priceMatrix[i][j].price); + foundPrice = true; + break; } + } + if (foundPrice) { + break; + } } + } - if (!foundPrice) { - productPrice = productObj.sale_price ? productObj.sale_price : productObj.regular_price; - // productPrice = parseFloat(document.getElementById("productNewPrice") ? document.getElementById("productNewPrice").innerText : document.getElementById("productPrice")); - // productPrice = parseFloat(document.getElementById("productNewPrice") ? document.getElementById("productNewPrice").innerText : document.getElementById("productPrice")); - // productPrice; - } + if (!foundPrice) { + productPrice = productObj.sale_price + ? productObj.sale_price + : productObj.regular_price; + // productPrice = parseFloat(document.getElementById("productNewPrice") ? document.getElementById("productNewPrice").innerText : document.getElementById("productPrice")); + // productPrice = parseFloat(document.getElementById("productNewPrice") ? document.getElementById("productNewPrice").innerText : document.getElementById("productPrice")); + // productPrice; + } var productData = { product: { @@ -696,7 +726,7 @@ function popupAddToCart( : "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"; console.log(response); - newOrder.innerHTML = ` + newOrder.innerHTML = ` product @@ -736,7 +766,7 @@ function popupAddToCart( } function getLatestOrders() { - var customerId = '' + var customerId = ""; // Fetch the order data fetch(`https://api.obanana.shop/api/v1/orders/customer/${customerId}`) .then((response) => response.json()) @@ -831,32 +861,38 @@ function popupAddToCart( var updatedQuantity = existingQuantity + newQuantity; // Check if the updated quantity exceeds the previous price matrix - var newProductPrice = productPrice; - var foundNewPrice = false; - if (priceMatrix.length > 0) { - for (var i = 0; i < priceMatrix.length; i++) { - for (var j = 0; j < priceMatrix[i].length; j++) { - var currentQuantity = parseFloat(priceMatrix[i][j].quantity); - var nextQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity; - if (updatedQuantity >= currentQuantity && updatedQuantity < nextQuantity) { - newProductPrice = parseFloat(priceMatrix[i][j].price); - foundNewPrice = true; - break; - } - } - if (foundNewPrice) { - break; - } - } + var newProductPrice = productPrice; + var foundNewPrice = false; + if (priceMatrix.length > 0) { + for (var i = 0; i < priceMatrix.length; i++) { + for (var j = 0; j < priceMatrix[i].length; j++) { + var currentQuantity = parseFloat(priceMatrix[i][j].quantity); + var nextQuantity = + j < priceMatrix[i].length - 1 + ? parseFloat(priceMatrix[i][j + 1].quantity) + : Infinity; + if ( + updatedQuantity >= currentQuantity && + updatedQuantity < nextQuantity + ) { + newProductPrice = parseFloat(priceMatrix[i][j].price); + foundNewPrice = true; + break; + } } - if (foundNewPrice) { - productPrice = newProductPrice; + break; } + } + } + + if (foundNewPrice) { + productPrice = newProductPrice; + } var updateData = { quantity: updatedQuantity, - price: productPrice + price: productPrice, }; updateOrderXhr.send(JSON.stringify(updateData)); diff --git a/cart.php b/cart.php index 3e49ae4..3366e5d 100644 --- a/cart.php +++ b/cart.php @@ -191,11 +191,26 @@ if ($_SESSION["userId"] <> "") {
+
+ @@ -229,6 +244,10 @@ if ($_SESSION["userId"] <> "") { ?> + @@ -333,6 +333,7 @@ $style = "display: flex; height: 15px;font-weight:400; width:90px; margin-top:10
Product Price Quantity
+ + + @@ -270,6 +289,34 @@ if ($_SESSION["userId"] <> "") { ?> + + + +
diff --git a/vendor-dashboard.php b/vendor-dashboard.php index 585b383..b3c30dd 100644 --- a/vendor-dashboard.php +++ b/vendor-dashboard.php @@ -254,7 +254,7 @@ if ($_SESSION["isCustomer"] == true) { $order = $vendorOrders[$i]; $orderArray = json_encode($order, true); $orderItems = json_decode($orderArray, true); - + if ($orderItems['status'] !== 'TO CHECKOUT' ) { foreach ($orderItems['items'] as $item) { ?>
diff --git a/vendor-refund-history.php b/vendor-refund-history.php index 6c3acbf..7370215 100644 --- a/vendor-refund-history.php +++ b/vendor-refund-history.php @@ -260,7 +260,7 @@ if ($_SESSION["isCustomer"] == true) {