Compare commits
2 Commits
8d98f924ee
...
cd347af5f2
Author | SHA1 | Date |
---|---|---|
MarkHipe | cd347af5f2 | |
Jun Barroga | d9aae2efda |
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
$_SESSION["is_test"]=false;
|
||||
$_SESSION["test_email_rcpt"]="";
|
||||
$_SESSION["sales_email"]="sales@obanana.com";
|
||||
$_SESSION["data_endpoint"]="api.obanana.com";
|
||||
$_SESSION["is_test"]=true;
|
||||
$_SESSION["test_email_rcpt"]="junjihadbarroga@gmail.com";
|
||||
$_SESSION["sales_email"]="junjihadbarroga@gmail.com";
|
||||
$_SESSION["data_endpoint"]="api.obanana.shop";
|
||||
if ($_SESSION["is_test"]){
|
||||
$_SESSION["obpay"]="web.obpay.online/test";
|
||||
$_SESSION["obpay_gate"]="gate.obpay.online/api";
|
||||
|
|
|
@ -491,7 +491,7 @@ function popupAddToCart(product, productVendor, token, email, password, customer
|
|||
var vendorObj = JSON.parse(productVendor);
|
||||
|
||||
var sessionToken = token;
|
||||
var productImage = productObj.product_image;
|
||||
var productImage = productObj.images;
|
||||
var productId = productObj._id;
|
||||
var productName = productObj.product_name;
|
||||
var productPrice = productObj.sale_price ? productObj.sale_price : productObj.regular_price;
|
||||
|
@ -600,13 +600,15 @@ function popupAddToCart(product, productVendor, token, email, password, customer
|
|||
|
||||
var newOrder = document.createElement("li");
|
||||
newOrder.id = `order_${response._id}`;
|
||||
var imageUrl = response.items[0].product.product_image ? response.items[0].product.product_image.split(',')[0].trim() : "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png";
|
||||
console.log(response)
|
||||
|
||||
newOrder.innerHTML = `
|
||||
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
|
||||
<img src="${response.items[0].product.product_image}" alt="product">
|
||||
<a href="product-left-sidebar.php?id=${response.items[0]._id}" class="sidekka_pro_img">
|
||||
<img src="${imageUrl}" alt="product" />
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
<a href="shop-left-sidebar-col-4.php" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<a href="product-left-sidebar.php?id=${response.items[0]._id}" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<span class="cart-price" id="cart-price">
|
||||
Unit Price: <span>${response.items[0].price}</span>
|
||||
</span>
|
||||
|
@ -675,13 +677,15 @@ function popupAddToCart(product, productVendor, token, email, password, customer
|
|||
if (cartItem) {
|
||||
var updatedQuantity = response.items[0].quantity; // Use the correct quantity from the updated order
|
||||
var totalAmount = response.items[0].price * updatedQuantity;
|
||||
var imageUrl = response.items[0].product.product_image ? response.items[0].product.product_image.split(',')[0].trim() : "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png";
|
||||
|
||||
// If the cart item already exists, update its content using innerHTML
|
||||
cartItem.innerHTML = `
|
||||
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
|
||||
<img src="${response.items[0].product.product_image}" alt="product">
|
||||
<a href="product-left-sidebar.php?id=${response.items[0]._id}"" class="sidekka_pro_img">
|
||||
<img src="${imageUrl}" alt="product">
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
<a href="shop-left-sidebar-col-4.php" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<a href="product-left-sidebar.php?id=${response.items[0]._id}"" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<span class="cart-price" id="cart-price">
|
||||
Unit Price: <span>${response.items[0].price}</span>
|
||||
</span>
|
|
@ -1114,7 +1114,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- raymart added js link feb 14 2024 -->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
|
|
|
@ -381,34 +381,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="assets/js/vendor/jquery-3.5.1.min.js"></script>
|
||||
<script src="assets/js/vendor/popper.min.js"></script>
|
||||
<script src="assets/js/vendor/bootstrap.min.js"></script>
|
||||
<script src="assets/js/vendor/jquery-migrate-3.3.0.min.js"></script>
|
||||
<script src="assets/js/vendor/modernizr-3.11.2.min.js"></script>
|
||||
|
||||
<!--Plugins JS-->
|
||||
<script src="assets/js/plugins/swiper-bundle.min.js"></script>
|
||||
<script src="assets/js/plugins/countdownTimer.min.js"></script>
|
||||
<script src="assets/js/plugins/scrollup.js"></script>
|
||||
<script src="assets/js/plugins/jquery.zoom.min.js"></script>
|
||||
<script src="assets/js/plugins/slick.min.js"></script>
|
||||
<script src="assets/js/plugins/infiniteslidev2.js"></script>
|
||||
<script src="assets/js/vendor/jquery.magnific-popup.min.js"></script>
|
||||
<script src="assets/js/plugins/jquery.sticky-sidebar.js"></script>
|
||||
|
||||
<!-- Main Js -->
|
||||
<script src="assets/js/vendor/index.js"></script>
|
||||
<script src="assets/js/main.js"></script>
|
||||
<!-- <script src="assets/js/texts2.js"></script> -->
|
||||
<!-- raymart added js feb 14, 2024-->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
113
checkouttest.php
113
checkouttest.php
|
@ -577,18 +577,29 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
<div class="col-sm-12 mb-6">
|
||||
<?php foreach ($checkout['items'] as $item) { ?>
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image">
|
||||
<a href="shop-left-sidebar-col-4.php" class="image">
|
||||
<img class="main-image" src="<?php echo $item['product']['product_image']; ?>" alt="Product" />
|
||||
<!-- <img class="hover-image"
|
||||
src="assets/images/product-image/1_2.jpg"
|
||||
alt="Product" /> -->
|
||||
<div class="ec-pro-image-outer" >
|
||||
<div class="ec-pro-image" style="width: 128px; height: 150px; display: flex; justify-content: center; align-items: center;">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $item['product']['product_id']; ?>">
|
||||
<?php
|
||||
if (isset($item['product']['product_image'])) {
|
||||
$image_urls = explode(',', $item['product']['product_image']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img class="main-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ec-pro-content">
|
||||
<h5 class="ec-pro-title"><a href="shop-left-sidebar-col-4.php"><?php echo $item['product']['name']; ?></a></h5>
|
||||
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $item['product']['product_id']; ?>"><?php echo $item['product']['name']; ?></a></h5>
|
||||
<div class="ec-pro-rating">
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
|
@ -599,11 +610,25 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
<span class="ec-price">
|
||||
<span class="new-price"><?php echo $item['price']; ?> x <?php echo $item['quantity']; ?></span>
|
||||
</span>
|
||||
<?php $checkProduct = getProduct($item['product']['product_id']);
|
||||
$decodedProduct = json_decode($checkProduct, true);
|
||||
$freeShipping = false;
|
||||
if (!empty($decodedProduct['promo']) && $decodedProduct['promo'][0]['free-shipping'] === 'Yes') {
|
||||
$freeShipping = true;
|
||||
}
|
||||
|
||||
// Set the shipping fee based on the condition
|
||||
$shippingFee = $freeShipping ? 0 : $checkout['shipping_fee'];
|
||||
|
||||
|
||||
// Set the shipping fee based on the condition
|
||||
?>
|
||||
|
||||
<span class="ec-price">
|
||||
<span class="new-price">Shipping Fee: <?php echo $checkout['shipping_fee']; ?></span>
|
||||
<span class="new-price">Shipping Fee: <?php echo $shippingFee; ?></span>
|
||||
</span>
|
||||
<span class="ec-price">
|
||||
<span class="new-price">Subtotal: <?php echo $checkout['shipping_fee'] + $checkout['total_amount']; ?></span>
|
||||
<span class="new-price">Subtotal: <?php echo $shippingFee + $checkout['total_amount']; ?></span>
|
||||
</span>
|
||||
<!-- 02-22-2024 Stacy hide variation -->
|
||||
<!-- <div class="ec-pro-option">
|
||||
|
@ -724,7 +749,21 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
<?php
|
||||
$totalAmount = 0;
|
||||
foreach ($cartItems as $checkout) {
|
||||
$totalAmount += $checkout['total_amount'] + $checkout['shipping_fee'];
|
||||
foreach ($checkout['items'] as $item) {
|
||||
$checkProduct = getProduct($item['product']['product_id']);
|
||||
$decodedProduct = json_decode($checkProduct, true);
|
||||
$freeShipping = false;
|
||||
|
||||
if (!empty($decodedProduct['promo']) && $decodedProduct['promo'][0]['free-shipping'] === 'Yes') {
|
||||
$freeShipping = true;
|
||||
}
|
||||
|
||||
// Set the shipping fee based on the condition
|
||||
$shippingFee = $freeShipping ? 0 : $checkout['shipping_fee'];
|
||||
|
||||
// Calculate total amount for each item
|
||||
$totalAmount += ($item['price'] + $shippingFee) * $item['quantity'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -856,13 +895,18 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
}
|
||||
} else if (pay2RadioButton.checked) {
|
||||
try {
|
||||
<?php foreach ($cartItems as $checkout) { ?>
|
||||
<?php foreach ($checkout['items'] as $item) { ?>
|
||||
itemNames.push("<?php echo str_replace('"', "\\'", $item['product']['name']) . ' (' . $item['quantity'] . ')'; ?>");
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
const base64Credentialss = btoa(`${username}:${password}`);
|
||||
const response = await fetch('https://<?php echo $_SESSION["obpay_gate"]; ?>/payment/links', {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
amount: totalAmount * 100,
|
||||
description: `ordered from obanana ecommerce website`,
|
||||
description: itemNames.join(', '),
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -879,51 +923,6 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
|
|||
|
||||
if (result) {
|
||||
|
||||
// Update payment status using PATCH request
|
||||
|
||||
// const ordersToUpdate = <?php
|
||||
// // $arr=$cartItemsJSON[12];
|
||||
// // $ref=$arr['attributes'];
|
||||
// // $id=$ref['_id'];
|
||||
|
||||
// echo $filteredIdsJSON;
|
||||
// // print_r($cartItemsArray);
|
||||
// // if (isset($cartItemsJSON['12'])) {
|
||||
// // $id = $cartItemsJSON['12'];
|
||||
// // echo $id;
|
||||
// // } else {
|
||||
// // echo "No _id found in the specified structure.";
|
||||
// // }
|
||||
//
|
||||
?>;
|
||||
// const ordersToUpdate = <?php echo $cartItems; ?>;
|
||||
// // console.log(ordersToUpdate);
|
||||
|
||||
// ordersToUpdate.forEach(async (order) => {
|
||||
// // console.log(orderId)
|
||||
// const shippingFee = order.shipping_fee ?? 50
|
||||
// const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${order._id}`, {
|
||||
// method: "PATCH",
|
||||
// body: JSON.stringify({
|
||||
// // shipping_address:{
|
||||
// // shipping_first_name: document.getElementById('selectedFName').innerText,
|
||||
// // },
|
||||
// payment: {
|
||||
// status: "UNPAID",
|
||||
// reference_number: result.attributes.reference_number,
|
||||
// },
|
||||
// }),
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
// // Add any additional headers as needed
|
||||
// },
|
||||
// });
|
||||
|
||||
// if (!patchResponse.ok) {
|
||||
// throw new Error(`Error updating payment status: ${patchResponse.status} ${patchResponse.statusText}`);
|
||||
// }
|
||||
// })
|
||||
|
||||
const currentDate = new Date();
|
||||
const iso8601String = currentDate.toISOString();
|
||||
const ordersToUpdate = <?php echo $cartencode; ?>;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="text-center footer-off-msg">
|
||||
<span>Win a contest! Get this limited-editon</span><a href="#" target="_blank">View
|
||||
Detail</a>
|
||||
<!-- <span>Win a contest! Get this limited-editon</span><a href="#" target="_blank">View
|
||||
Detail</a> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
20
header.php
20
header.php
|
@ -228,7 +228,7 @@
|
|||
?><?php
|
||||
if ($_SESSION["isVendor"]) {
|
||||
?>
|
||||
<li><a class="dropdown-item" href="vendor-settings.php">My Account</a></li>
|
||||
<li><a class="dropdown-item" href="vendor-dashboard.php">My Account</a></li>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
@ -378,7 +378,23 @@
|
|||
$product_data = json_decode($product, true);
|
||||
?>
|
||||
<li id="order_<?php echo $order['_id'] ?>">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>" class="sidekka_pro_img"><img src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></a>
|
||||
<a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>" class="sidekka_pro_img">
|
||||
<?php
|
||||
if (isset($order['items'][0]['product']['product_image'])) {
|
||||
$image_urls = explode(',', $order['items'][0]['product']['product_image']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img src="<?php echo $first_image_url; ?>" alt="product" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
|
||||
<a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>" class="cart_pro_title"><?php echo $order['items'][0]['product']['name']; ?></a>
|
||||
|
|
|
@ -1819,7 +1819,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- raymart added js feb 14, 2024-->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
|
|
|
@ -1945,7 +1945,7 @@ if (isset($_GET['id'])) {
|
|||
<!-- 02-21-2024 Stacy added js link -->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
|
|
|
@ -900,7 +900,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<script src="assets/js/main.js"></script>
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
|
|
|
@ -4,13 +4,16 @@
|
|||
$categories = isset($_POST['category']) ? $_POST['category'] : array();
|
||||
$categoryFinal = null;
|
||||
$count=0;
|
||||
|
||||
foreach ($categories as $category) {
|
||||
// Perform checks or actions for each category
|
||||
// For example:
|
||||
$categoriesCopy = $categoryFinal;
|
||||
$categoryFinal =$categoryFinal!== null? $categoriesCopy . '&category['.$count.']='.$category:$categoriesCopy . 'category['.$count.']='.$category;
|
||||
$count+=1;
|
||||
echo "Processing category: $category <br>";
|
||||
|
||||
|
||||
echo $categoryFinal;
|
||||
// You can add your logic here
|
||||
}
|
||||
$minPrice = isset($_POST['minPrice']) ? $_POST['minPrice'] : null;
|
||||
|
|
|
@ -15,90 +15,55 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
|
||||
// 02-19-2024 Jun Jihad Search Filter
|
||||
$filteredProducts = [];
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$minPrice = ($_POST['minPrice'] !== '' && is_numeric($_POST['minPrice'])) ? floatval($_POST['minPrice']) : null;
|
||||
$maxPrice = ($_POST['maxPrice'] !== '' && is_numeric($_POST['maxPrice'])) ? floatval($_POST['maxPrice']) : null;
|
||||
echo "Min Price: " . ($minPrice !== null ? $minPrice : "null") . "<br>";
|
||||
echo "Max Price: " . ($maxPrice !== null ? $maxPrice : "null") . "<br>";
|
||||
if (isset($_POST['category'])) {
|
||||
$selectedCategories = $_POST['category'];
|
||||
foreach ($selectedCategories as $selectedCategory) {
|
||||
$category = strtolower(trim($selectedCategory));
|
||||
foreach ($productSearchResult['results'] as $result) {
|
||||
$productCategory = strtolower(trim($result['product']['product_category']));
|
||||
$productPrice = isset($result['product']['sale_price']) ? $result['product']['sale_price'] : $result['product']['regular_price'];
|
||||
|
||||
if ($minPrice === null) {
|
||||
$minPrice = 0;
|
||||
}
|
||||
if ($maxPrice === null) {
|
||||
$maxPrice = PHP_FLOAT_MAX;
|
||||
}
|
||||
if (
|
||||
$productCategory == $category &&
|
||||
($productPrice >= $minPrice) &&
|
||||
($productPrice <= $maxPrice)
|
||||
) {
|
||||
$filteredProducts[] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If no category is selected, filter only by price range
|
||||
foreach ($productSearchResult['results'] as $result) {
|
||||
$productPrice = isset($result['product']['sale_price']) ? $result['product']['sale_price'] : $result['product']['regular_price'];
|
||||
|
||||
if ($minPrice === null) {
|
||||
$minPrice = 0;
|
||||
}
|
||||
|
||||
if ($maxPrice === null) {
|
||||
$maxPrice = PHP_FLOAT_MAX;
|
||||
}
|
||||
|
||||
if (($productPrice >= $minPrice) &&
|
||||
($productPrice <= $maxPrice)
|
||||
) {
|
||||
$filteredProducts[] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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") . "<br>";
|
||||
echo "Max Price: " . ($maxPrice !== null ? $maxPrice : "null") . "<br>";
|
||||
// echo "Min Price: " . ($minPrice !== null ? $minPrice : "null") . "<br>";
|
||||
// echo "Max Price: " . ($maxPrice !== null ? $maxPrice : "null") . "<br>";
|
||||
|
||||
$selectedCategories = isset($_GET['category']) ? $_GET['category'] : [];
|
||||
|
||||
if (!empty($selectedCategories)) {
|
||||
|
||||
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']));
|
||||
$productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price'];
|
||||
if ($minPrice === null) {
|
||||
$minPrice = 0;
|
||||
}
|
||||
|
||||
if ($maxPrice === null) {
|
||||
$maxPrice = PHP_FLOAT_MAX;
|
||||
}
|
||||
|
||||
if (
|
||||
$productCategory == $category &&
|
||||
($minPrice === null || $productPrice >= $minPrice) &&
|
||||
($maxPrice === null || $productPrice <= $maxPrice)
|
||||
$productCategory == $category
|
||||
) {
|
||||
$filteredProducts[] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} 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'];
|
||||
|
@ -108,7 +73,7 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
|
||||
if ($maxPrice === null) {
|
||||
$maxPrice = PHP_FLOAT_MAX;
|
||||
}
|
||||
}
|
||||
if (($minPrice === null || $productPrice >= $minPrice) &&
|
||||
($maxPrice === null || $productPrice <= $maxPrice)
|
||||
) {
|
||||
|
@ -342,18 +307,35 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
for ($x = $startIndex; $x <= $endIndex; $x++) {
|
||||
$product = $filteredProducts[$x]['product'];
|
||||
$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";
|
||||
// $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;
|
||||
$regular_price = isset($product['regular_price']) ? $product['regular_price'] : null;
|
||||
?>
|
||||
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-6 mb-6 pro-gl-content width-100">
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image-outer" style="width: 290px; height: 200px;">
|
||||
<div class="ec-pro-image">
|
||||
<a href="shop-left-sidebar-col-4.php" class="image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>">
|
||||
<?php
|
||||
if (isset($product['images'])) {
|
||||
$image_urls = explode(',', $product['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img style="width: 290px; height: 200px; object-fit: cover;" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<!-- <a href="shop-left-sidebar-col-4.php" class="image">
|
||||
<img class="main-image" src="<?php echo $product_image ?>" alt="Product" />
|
||||
<img class="hover-image" src="<?php echo $product_image ?>" alt="Product" />
|
||||
</a>
|
||||
</a> -->
|
||||
<div class="ec-pro-actions">
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
|
||||
|
@ -1016,7 +998,13 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<!-- Main Js -->
|
||||
<script src="assets/js/vendor/index.js"></script>
|
||||
<script src="assets/js/main.js"></script>
|
||||
<script src="assets/js/tester3.js"></script>
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
@ -872,7 +872,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- raymart added js link feb 14 2024 -->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
|
|
|
@ -770,10 +770,10 @@ if ($_SESSION["userId"] <> "") {
|
|||
<script src="assets/js/vendor/index.js"></script>
|
||||
<script src="assets/js/main.js"></script>
|
||||
<!-- raymart added link from js feb 14 2024 -->
|
||||
<!-- <script src="assets/js/tester5.js"></script> -->
|
||||
<!-- <script src="assets/js/tester10.js"></script> -->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester5.js"></script>';
|
||||
echo '<script src="assets/js/tester10.js"></script>';
|
||||
} else {
|
||||
echo '<script src="assets/js/produc3.js"></script>';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue