From 2e505256f6b2c6684dc7e5e2dcf951ad58aafe51 Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Thu, 7 Mar 2024 10:18:12 +0800 Subject: [PATCH] checkout_page_updates --- assets/js/tester11.js | 1 - checkouttest.php | 65 +- shop-list-left-sidebar-test.php | 1011 +++++++++++++++++++++++++++++++ shop-list-left-sidebar.php | 6 +- user-history.php | 36 +- 5 files changed, 1085 insertions(+), 34 deletions(-) create mode 100644 shop-list-left-sidebar-test.php diff --git a/assets/js/tester11.js b/assets/js/tester11.js index 3560698..40b3fde 100644 --- a/assets/js/tester11.js +++ b/assets/js/tester11.js @@ -690,7 +690,6 @@ function popupAddToCart(product, productVendor, token, email, password, customer Unit Price: ${response.items[0].price} Subtotal: ${totalAmount} - // raymart feb 26 2024
-
diff --git a/checkouttest.php b/checkouttest.php index 6584c87..32373d1 100644 --- a/checkouttest.php +++ b/checkouttest.php @@ -556,7 +556,16 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] }); - Place Order + '; + } else { + echo ' + + Place Order + '; + } + ?>
@@ -1017,23 +1026,57 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] const randomIndex = Math.floor(Math.random() * refchar.length); uniqueRef += refchar.charAt(randomIndex); } + + const selectedFName = document.getElementById('selectedFName').innerText; + const selectedLName = document.getElementById('selectedLName').innerText; + const selectedContact = document.getElementById('selectedContact').innerText; + const sBuilding = document.getElementById('sBuilding').innerText; + const sStreet = document.getElementById('sStreet').innerText; + const sCity = document.getElementById('sCity').innerText; + const sBarangay = document.getElementById('sBarangay').innerText; + const sProvince = document.getElementById('sProvince').innerText; + const sCountry = document.getElementById('sCountry').innerText; + if ( + selectedFName.trim() === "" || + selectedLName.trim() === "" || + selectedContact.trim() === "" || + sBuilding.trim() === "" || + sStreet.trim() === "" || + sCity.trim() === "" || + sBarangay.trim() === "" || + sProvince.trim() === "" || + sCountry.trim() === "" + ) { + alert("Please select address."); + return; // Stop further execution + } newArray.forEach(async (orderId) => { console.log(orderId) const token = ''; const shippingfee = parseFloat(orderId.shipping_fee) + + const orderProductId = orderId.items[0].product.product_id; + const productResponse = await fetch(`https:///api/v1/products/${orderProductId}`); + const productData = await productResponse.json(); + let freeShippingCod = false; + if (productData.promo && productData.promo.length > 0 && productData.promo[0]['free-shipping'] === 'Yes') { + freeShippingCod = true; + } + + const shippingFees = freeShippingCod ? 0 : shippingfee; const patchResponse = await fetch(`https:///api/v1/orders/${orderId._id}`, { method: "PATCH", body: JSON.stringify({ shipping_address: { - shipping_first_name: document.getElementById('selectedFName').innerText, - shipping_last_name: document.getElementById('selectedLName').innerText, - shipping_phone: document.getElementById('selectedContact').innerText, - shipping_address_1: document.getElementById('sBuilding').innerText, - shipping_address_2: document.getElementById('sStreet').innerText, - shipping_city: document.getElementById('sCity').innerText, - shipping_barangay: document.getElementById('sBarangay').innerText, - shipping_state: document.getElementById('sProvince').innerText, - shipping_country: document.getElementById('sCountry').innerText, + shipping_first_name: selectedFName, + shipping_last_name: selectedLName, + shipping_phone: selectedContact, + shipping_address_1: sBuilding, + shipping_address_2: sStreet, + shipping_city: sCity, + shipping_barangay: sBarangay, + shipping_state: sProvince, + shipping_country: sCountry, }, billing_address: { billing_first_name: billingFName, @@ -1050,7 +1093,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] status: "UNPAID", reference_number: uniqueRef, }, - total_amount: parseFloat(orderId.total_amount) + shippingfee, + total_amount: parseFloat(orderId.total_amount) + shippingFees, status: "TO PAY", order_date: iso8601String, payment_method: "Cash On Delivery", diff --git a/shop-list-left-sidebar-test.php b/shop-list-left-sidebar-test.php new file mode 100644 index 0000000..17dbeff --- /dev/null +++ b/shop-list-left-sidebar-test.php @@ -0,0 +1,1011 @@ + "") { + $_SESSION["isLoggedIn"] = true; + $customer_data = getCustomerbyLoginId($_SESSION["userId"]); +} else { + $_SESSION["isLoggedIn"] = false; +} +$productSearchResult = $_SESSION["productSearchResult"]; +$vendorSearchResult = $_SESSION["vendorSearchResult"]; + + + +// 02-19-2024 Jun Jihad Search Filter +$filteredProducts = []; + +if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['category'])) { + $filteredProducts = []; + $minPrice = isset($_GET['minPrice']) && $_GET['minPrice'] !== '' ? floatval($_GET['minPrice']) : null; + $maxPrice = isset($_GET['maxPrice']) && $_GET['maxPrice'] !== '' ? floatval($_GET['maxPrice']) : null; + + // echo "Min Price: " . ($minPrice !== null ? $minPrice : "null") . "
"; + // echo "Max Price: " . ($maxPrice !== null ? $maxPrice : "null") . "
"; + + $selectedCategories = isset($_GET['category']) ? $_GET['category'] : []; + + if (!empty($selectedCategories) && (($minPrice == null) && ($maxPrice == null))) { + foreach ($selectedCategories as $selectedCategory) { + $category = strtolower(trim($selectedCategory)); + foreach ($productSearchResult['results'] as $result) { + $product = $result['product']; + + $productCategory = strtolower(trim($product['product_category'])); + + if ( + $productCategory == $category + ) { + $filteredProducts[] = $result; + } + } + } + } elseif (!empty($selectedCategories) && (!empty($minPrice) || !empty($maxPrice))) { + if ($minPrice === null) { + $minPrice = 0; + } + if ($maxPrice === null) { + $maxPrice = PHP_FLOAT_MAX; + } + foreach ($selectedCategories as $selectedCategory) { + $category = strtolower(trim($selectedCategory)); + foreach ($productSearchResult['results'] as $result) { + $product = $result['product']; + $productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price']; + $productCategory = strtolower(trim($product['product_category'])); + if ( + $productCategory = $category && (($productPrice >= $minPrice) && + ($productPrice <= $maxPrice)) + ) { + $filteredProducts[] = $result; + } + } + } + } + else { + foreach ($productSearchResult['results'] as $result) { + $product = $result['product']; + $productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price']; + if ($minPrice === null) { + $minPrice = 0; + } + + if ($maxPrice === null) { + $maxPrice = PHP_FLOAT_MAX; + } + if (($minPrice === null || $productPrice >= $minPrice) && + ($maxPrice === null || $productPrice <= $maxPrice) + ) { + $filteredProducts[] = $result; + } + } + } +} else { + $filteredProducts = $productSearchResult['results']; +} +?> + + + + + + + + + oBanana B2B - Elevate Your Business + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+

Shop

+
+
+ + + +
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+ + +
+
+
+ Sort by +
+ +
+
+
+ + + +
+
+
Vendor Search Results
+ + +
+ +
+
+
+
+
+ + <?php echo $vendor['user_login']; ?> + + + +
+ +
+
+
Seller Products
+ +

+
+
+
+
+
Seller since
+

+
+
+
+ +
+
+
+ +
+
+
+ + + + +
+
+
+ +
+
+
+
+ "> + + edit + + edit + + + +
+ + +
+
+
+
+
">
+
+ + 0) : ?> + + + + + + Inquire + + Inquire + + +
+
+
+ +
+
+ +
+ Showing - of item(s) +
    + + 1) { + ?> +
  • 1
  • + 2) { + ?> +
  • ...
  • + $minPrice, 'maxPrice' => $maxPrice); + if (isset($_POST['category'])) { + $filterParams['category'] = $_POST['category']; + } + $paginationUrl = '?' . http_build_query(array_merge($_GET, $_POST, array('page' => $page))); + + + ?> +
  • + +
  • ...
  • + +
  • + +
+
+ + +
+ +
+ +
+
+
+

Filter Products By

+
+
+ +
+
+

Category

+
+
+
+ + + +
+ + +
+
+ + + + + +
+
+
+
+
+
+ + + + + + + + + + + + +
+
+
+
+ +
+
+ 3 +
+
+ +
+
+ 4 +
+
+ +
+ +
+
+
+ + + +
+ payment image +
+

Someone in new just bought

+
stylish baby shoes
+

10 Minutes ago

+
+ × +
+ + + +
+ +
+
+ 3 +
+
+ + + +
+ + + + +
+
+
+ whatsapp icon +
+
+
+ +
+ + + +
+
+
+

Features

+
+ + icon + +
+
+

Color Scheme

+
    +
  • +
  • +
  • +
  • +
  • +
+
+
+

Backgrounds

+ +
+
+

Full Screen mode

+
+
+
Mode
+
On
+
Off
+
+
+
+
+

Dark mode

+
+
+
Mode
+
On
+
Off
+
+
+
+
+

RTL mode

+
+
+
Rtl
+
On
+
Off
+
+
+
+
+

Clear local storage

+ Clear Cache & Default +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + '; + } else { + echo ''; + } + ?> + + + + \ No newline at end of file diff --git a/shop-list-left-sidebar.php b/shop-list-left-sidebar.php index 67d7980..e8987b8 100644 --- a/shop-list-left-sidebar.php +++ b/shop-list-left-sidebar.php @@ -307,6 +307,8 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate for ($x = $startIndex; $x <= $endIndex; $x++) { $product = $filteredProducts[$x]['product']; + $productWithoutSpecs = $product; + unset($productWithoutSpecs['specifications']); $vendorOfProduct = getVendorbyId($product['vendor_api_id']); // $product_image = !empty($product["product_image"]) ? $product["product_image"] : "https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/330px-No-Image-Placeholder.svg.png"; $sale_price = isset($product['sale_price']) ? $product['sale_price'] : null; @@ -338,8 +340,8 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate Product -->
- - + +
diff --git a/user-history.php b/user-history.php index cb9c830..e2ac230 100644 --- a/user-history.php +++ b/user-history.php @@ -363,7 +363,9 @@ if ($_SESSION["userId"] <> "") { Refund Requested'; - } else { + } elseif ($order['return_order']['status'] === 'To Ship') { + echo 'For Refund'; + }else { echo 'Return/Refund'; } ?> @@ -383,7 +385,6 @@ if ($_SESSION["userId"] <> "") { -