This commit is contained in:
raymart 2024-02-22 09:11:47 +08:00
commit e2342e735d
11 changed files with 286 additions and 154 deletions

View File

@ -3,4 +3,11 @@ $_SESSION["is_test"]=true;
$_SESSION["test_email_rcpt"]="stacyjoycemapano@gmail.com";
$_SESSION["sales_email"]="stacyjoycemapano@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";
} else {
$_SESSION["obpay"]="web.obpay.online";
$_SESSION["obpay_gate"]="gate.obpay.online/api/v1";
}
?>

View File

@ -1,5 +1,5 @@
<?php
include "../functions.php";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input = json_decode(file_get_contents('php://input'), true);

View File

@ -848,7 +848,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
} else if (pay2RadioButton.checked) {
try {
const base64Credentialss = btoa(`${username}:${password}`);
const response = await fetch('https://gate.obpay.online/api/payment/links', {
const response = await fetch('https://<?php echo $_SESSION["obpay_gate"]; ?>/payment/links', {
method: "POST",
body: JSON.stringify({
amount: totalAmount * 100,

View File

@ -856,7 +856,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"]
try {
const base64Credentialss = btoa(`${username}:${password}`);
const response = await fetch('https://gate.obpay.online/api/v1/payment/links', {
const response = await fetch('https://<?php echo $_SESSION["obpay_gate"]; ?>/payment/links', {
method: "POST",
body: JSON.stringify({
amount: totalAmount * 100,

View File

@ -51,7 +51,7 @@ function sddProducts()
curl_close($curl);
$json = json_decode($response, true);
$products = array_filter($json, function ($var) {
return ($var['promo'][0]['next-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['next-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['next-day-delivery'] === "Yes" && $var['product_type'] == 'variable' );
return ($var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'variable' );
});
$products = array_values($products);
return $products;

View File

@ -862,7 +862,7 @@
<li><a href="privacy-policy.html">Privacy Policy</a></li>
</ul> -->
</li>
<li class="dropdown"><span class="main-label-note-new" data-toggle="tooltip" title="NEW"></span><a href="same_day_delivery.php">Same-Day-Delivery</a>
<li class="dropdown"><span class="main-label-note-new" data-toggle="tooltip" title="NEW"></span><a href="same_day_delivery.php">Next-Day-Delivery</a>
<!-- <ul class="sub-menu">
<li class="dropdown position-static"><a href="javascript:void(0)">Mail
Confirmation

View File

@ -464,9 +464,9 @@ if ($_SESSION["userId"] <> "") {
<div class="row">
<div class="col-xl-6 col-lg-7 col-md-7 col-sm-7 align-self-center">
<div class="ec-slide-content slider-animation">
<h1 class="ec-slide-title">Obanana Series 2 PowerBank Collection</h1>
<h2 class="ec-slide-stitle">More that just a backup - a lifeline for your devices</h2>
<p>A perfect blend of style and substance - stay in control of your day!</p>
<h1 class="ec-slide-title">FREE SHIPPING!</h1>
<h2 class="ec-slide-stitle">Obanana Series 2 PowerBank Collection</h2>
<p>More that just a backup - a lifeline for your devices. A perfect blend of style and substance - stay in control of your day!</p>
<a href="https://obanana.com/product-left-sidebar.php?id=6576c58dd1dba10ba2392765" class="btn btn-lg btn-secondary">Order Now</a>
</div>
</div>

View File

@ -115,10 +115,10 @@ if ($_SESSION["userId"] <> "") {
<div class="row">
<div class="col-xl-6 col-lg-7 col-md-7 col-sm-7 align-self-center">
<div class="ec-slide-content slider-animation">
<h1 class="ec-slide-title">Obanana Series 2 PowerBank Collection</h1>
<h2 class="ec-slide-stitle">More that just a backup - a lifeline for your devices</h2>
<p>A perfect blend of style and substance - stay in control of your day!</p>
<a href="https://obanana.com/product-left-sidebar.php?id=6576c58dd1dba10ba2392765" class="btn btn-lg btn-secondary">Order Now</a>
<h1 class="ec-slide-title">Next Day Delivery!</h1>
<h2 class="ec-slide-stitle">Get your purchased items within 24 hours!</h2>
<p>Your satisfaction is our priority, and we're here to make your shopping experience convenient and enjoyable!</p>
<!-- <a href="https://obanana.com/product-left-sidebar.php?id=6576c58dd1dba10ba2392765" class="btn btn-lg btn-secondary">Order Now</a> -->
</div>
</div>
</div>
@ -142,16 +142,15 @@ if ($_SESSION["userId"] <> "") {
<div class="row">
<div class="col-lg-6 col-md-12">
<div class="ec-cat-bnr">
<a href="shop-left-sidebar-col-4.php"><span></span></a>
<a href="shop-left-sidebar-col-4.php"><span><img src="https://api.obanana.com/images/storage/web_images/1708412192539-NEXT%20DAY%20delivery.png" alt=""></span></a>
</div>
</div>
<div class="col-lg-6 col-md-12">
<div class="ec-page-description">
<h6>The Best deal on top brands</h6>
<p class="m-0">Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s. It has survived not only five centuries, but also the
leap into electronic typesetting, remaining essentially unchanged.
<p class="m-0">
We strive to provide exceptional service to our valued customers!
When you make purchases from this list, we're delighted to ensure that they are promptly delivered to you on the very next day. Your satisfaction is our priority, and we're here to make your shopping experience convenient and enjoyable!
<p>
</div>
</div>

View File

@ -0,0 +1,26 @@
<?php
// 02-21-2024 Jun Jihad Search Filter Action
$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>";
// You can add your logic here
}
$minPrice = isset($_POST['minPrice']) ? $_POST['minPrice'] : null;
$maxPrice = isset($_POST['maxPrice']) ? $_POST['maxPrice'] : null;
if(isset($categoryFinal)){
header("location: shop-list-left-sidebar.php?$categoryFinal&minPrice=$minPrice&maxPrice=$maxPrice");
}else{
header("location: shop-list-left-sidebar.php?&minPrice=$minPrice&maxPrice=$maxPrice");
}
// 02-21-2024 Jun Jihad Search Filter Action

View File

@ -9,12 +9,112 @@ if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = false;
}
$productSearchResult = $_SESSION["productSearchResult"];
// var_dump($product);
// 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 (isset($_SESSION["productSearchResult"])) {
// $productSearchResult = $_SESSION["productSearchResult"];
// var_dump($productSearchResult)
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>";
$selectedCategories = isset($_GET['category']) ? $_GET['category'] : [];
if (!empty($selectedCategories)) {
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)
) {
$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'];
}
?>
<!DOCTYPE html>
<html lang="en">
@ -158,40 +258,22 @@ $productSearchResult = $_SESSION["productSearchResult"];
</div>
<!-- Shop Top End -->
<!-- Shop content Start -->
<div class="shop-pro-content">
<div class="shop-pro-inner list-view">
<div class="row">
<?php
// echo count($productSearchResult["results"]);
// var_dump($productSearchResult["results"][10]["product"]);
// var_dump($_SESSION["productSearchResult"]);
// for($x=0;$x<=11;$x++){
// $pid = rand(0,count($simpleProducts)-1);
$productsPerPage = 10; // Set the number of products to display per page
$currentPage = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
$startIndex = ($currentPage - 1) * $productsPerPage;
$endIndex = min($startIndex + $productsPerPage - 1, count($productSearchResult['results']) - 1);
$endIndex = min($startIndex + $productsPerPage - 1, count($filteredProducts) - 1);
for ($x = $startIndex; $x <= $endIndex; $x++) {
$product = $productSearchResult['results'][$x]['product'];
$product = $filteredProducts[$x]['product'];
$vendorOfProduct = getVendorbyId($product['vendor_api_id']);
// $pid = rand(0, count($productSearchResult["results"]) - 1);
// $product = $productSearchResult["results"][$pid]["product"];
$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;
//var_dump( $productSearchResult["results"][0]["product"]["product_name"]);
// var_dump($productSearchResult);
// if (isset($_SESSION["noProductsFound"]) && $_SESSION["noProductsFound"]) {
// echo '<div class="no-products-found">No products found</div>';
// } else {
// foreach ($productSearchResult["results"] as $productItem) {
// $product = $productItem["product"];
// $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";
?>
<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">
@ -208,80 +290,43 @@ $productSearchResult = $_SESSION["productSearchResult"];
</div>
</div>
<div class="ec-pro-content">
<!-- <h5 class="ec-pro-title"><a href="shop-left-sidebar-col-4.php?id=<?php echo $product["_id"]; ?>"> -->
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>">
<?php echo $product["product_name"] ?></a></h5>
<!-- <div class="ec-pro-rating">
<i class="ecicon eci-star fill"></i>
<i class="ecicon eci-star fill"></i>
<i class="ecicon eci-star fill"></i>
<i class="ecicon eci-star fill"></i>
<i class="ecicon eci-star"></i>
</div> -->
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>"><?php echo $product["product_name"] ?></a></h5>
<div class="ec-pro-list-desc"><?php echo $product["product_description"] ?></div>
<span class="ec-price">
<?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
<span class="old-price">&#8369;<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
<span class="new-price">&#8369;<?php echo number_format($product["sale_price"], 2, ".", ",") ?></span>
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
<span class="new-price">&#8369;<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
<?php elseif ($product["regular_price"] == "" || $product["regular_price"] == null) : ?>
<span class="inquire-text">Inquire</span>
<?php else : ?>
<span class="inquire-text">Inquire</span>
<?php endif; ?>
</span>
<!-- <div class="ec-pro-option">
<div class="ec-pro-color">
<span class="ec-pro-opt-label">Color</span>
<ul class="ec-opt-swatch ec-change-img">
<li class="active"><a href="#" class="ec-opt-clr-img" data-src="<?php echo $product["product_image"] ?>" data-src-hover="<?php echo $product["product_image"] ?>" data-tooltip="Gray"><span style="background-color:#e8c2ff;"></span></a></li>
<li><a href="#" class="ec-opt-clr-img" data-src="<?php echo $product["product_image"] ?>" data-src-hover="<?php echo $product["product_image"] ?>" data-tooltip="Orange"><span style="background-color:#9cfdd5;"></span></a></li>
</ul>
</div>
<div class="ec-pro-size">
<span class="ec-pro-opt-label">Size</span>
<ul class="ec-opt-size">
<li class="active"><a href="#" class="ec-opt-sz" data-old="$25.00" data-new="$20.00" data-tooltip="Small">S</a></li>
<li><a href="#" class="ec-opt-sz" data-old="$27.00" data-new="$22.00" data-tooltip="Medium">M</a></li>
<li><a href="#" class="ec-opt-sz" data-old="$30.00" data-new="$25.00" data-tooltip="Large">X</a></li>
<li><a href="#" class="ec-opt-sz" data-old="$35.00" data-new="$30.00" data-tooltip="Extra Large">XL</a></li>
</ul>
</div>
</div> -->
</div>
</div>
</div>
<?php
}
// }
?>
</div>
</div>
<!-- Ec Pagination Start -->
<div class="ec-pro-pagination">
<span>Showing <?php echo $startIndex + 1; ?>-<?php echo $endIndex + 1; ?> of <?php echo count($productSearchResult['results']); ?> item(s)</span>
<span>Showing <?php echo $startIndex + 1; ?>-<?php echo $endIndex + 1; ?> of <?php echo count($filteredProducts); ?> item(s)</span>
<ul class="ec-pro-pagination-inner">
<?php
// Calculate the total number of pages
$totalPages = ceil(count($productSearchResult['results']) / $productsPerPage);
// Define the maximum number of pagination links to display
$totalPages = ceil(count($filteredProducts) / $productsPerPage);
$maxPaginationLinks = 5;
// Calculate the range of pagination links to display
$startPage = max(1, $currentPage - floor($maxPaginationLinks / 2));
$endPage = min($startPage + $maxPaginationLinks - 1, $totalPages);
// Display the first page link
if ($startPage > 1) {
?>
<li><a href="?page=1">1</a></li>
<?php
// Add an ellipsis if there are more pages before the first displayed page
if ($startPage > 2) {
?>
<li><span>...</span></li>
@ -289,17 +334,21 @@ $productSearchResult = $_SESSION["productSearchResult"];
}
}
// Display pagination links within the defined range
for ($page = $startPage; $page <= $endPage; $page++) {
$activeClass = ($page == $currentPage) ? 'active' : '';
$filterParams = array('minPrice' => $minPrice, 'maxPrice' => $maxPrice);
if (isset($_POST['category'])) {
$filterParams['category'] = $_POST['category'];
}
$paginationUrl = '?' . http_build_query(array_merge($_GET, $_POST, array('page' => $page)));
?>
<li><a class="<?php echo $activeClass; ?>" href="?page=<?php echo $page; ?>"><?php echo $page; ?></a></li>
<li><a class="<?php echo $activeClass; ?>" href="<?php echo $paginationUrl; ?>"><?php echo $page; ?></a></li>
<?php
}
// Display the last page link
if ($endPage < $totalPages) {
// Add an ellipsis if there are more pages after the last displayed page
if ($endPage < $totalPages - 1) {
?>
<li><span>...</span></li>
@ -330,77 +379,128 @@ $productSearchResult = $_SESSION["productSearchResult"];
<h3 class="ec-sidebar-title">Category</h3>
</div>
<div class="ec-sb-block-content">
<ul>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" checked /> <a href="#">clothes</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">Bags</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">Shoes</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">cosmetics</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">electrics</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">phone</a><span class="checked"></span>
</div>
</li>
<li id="ec-more-toggle-content" style="padding: 0; display: none;">
<ul>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">Watch</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" /> <a href="#">Cap</a><span class="checked"></span>
</div>
</li>
</ul>
</li>
<li>
<div class="ec-sidebar-block-item ec-more-toggle">
<span class="checked"></span><span id="ec-more-toggle">More
Categories</span>
</div>
</li>
<form method="POST" action="shop-list-left-sidebar-action.php">
<ul>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Electronics" <?php echo (isset($_POST['category']) && in_array('Electronics', $_POST['category'])) || (isset($_GET['category']) && in_array('Electronics', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Electronics</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Solar" <?php echo (isset($_POST['category']) && in_array('Solar', $_POST['category'])) || (isset($_GET['category']) && in_array('Solar', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Solar</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="E-bike" <?php echo (isset($_POST['category']) && in_array('E-bike', $_POST['category'])) || (isset($_GET['category']) && in_array('E-bike', $_GET['category'])) ? 'checked' : ''; ?> /> <a>E-bike</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="E-vehicle" <?php echo (isset($_POST['category']) && in_array('E-vehicle', $_POST['category'])) || (isset($_GET['category']) && in_array('E-vehicle', $_GET['category'])) ? 'checked' : ''; ?> /> <a>E-vehicle</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Appliance" <?php echo (isset($_POST['category']) && in_array('Appliance', $_POST['category'])) || (isset($_GET['category']) && in_array('Appliance', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Appliance</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Smart Home" <?php echo (isset($_POST['category']) && in_array('Smart Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Smart Home', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Smart Home</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Home" <?php echo (isset($_POST['category']) && in_array('Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Home', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Home</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Heavy Equipment" <?php echo (isset($_POST['category']) && in_array('Heavy Equipment', $_POST['category'])) || (isset($_GET['category']) && in_array('Heavy Equipment', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Heavy Equipment</a><span class="checked"></span>
</div>
</li>
<li>
<div>
<label for="minPrice">Min Price:</label>
<input type="number" name="minPrice" id="minPrice" value="<?php echo isset($_POST['minPrice']) ? $_POST['minPrice'] : (isset($_GET['minPrice']) ? $_GET['minPrice'] : ''); ?>" />
</div>
</li>
<li>
<div>
<label for="maxPrice">Max Price:</label>
<input type="number" name="maxPrice" id="maxPrice" value="<?php echo isset($_POST['maxPrice']) ? $_POST['maxPrice'] : (isset($_GET['maxPrice']) ? $_GET['maxPrice'] : ''); ?>" />
</div>
</li>
</ul>
<button type="submit">Apply</button>
</form>
<!-- <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] . '?' . http_build_query(array_merge($_GET, $_POST)); ?>">
<ul>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Electronics" <?php echo (isset($_POST['category']) && in_array('Electronics', $_POST['category'])) ? 'checked' : ''; ?> /> <a>Electronics</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Solar" <?php echo (isset($_POST['category']) && in_array('Solar', $_POST['category'])) ? 'checked' : ''; ?> /> <a>Solar</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="E-bike" <?php echo (isset($_POST['category']) && in_array('E-bike', $_POST['category'])) ? 'checked' : ''; ?> /> <a>E-bike</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="E-vehicle" <?php echo (isset($_POST['category']) && in_array('E-vehicle', $_POST['category'])) ? 'checked' : ''; ?> /> <a>E-vehicle</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Appliance" <?php echo (isset($_POST['category']) && in_array('Appliance', $_POST['category'])) ? 'checked' : ''; ?> /> <a>Appliance</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Smart Home" <?php echo (isset($_POST['category']) && in_array('Smart Home', $_POST['category'])) ? 'checked' : ''; ?> /> <a>Smart Home</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Home" <?php echo (isset($_POST['category']) && in_array('Home', $_POST['category'])) ? 'checked' : ''; ?> /> <a>Home</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Heavy Equipment" <?php echo (isset($_POST['category']) && in_array('Heavy Equipment', $_POST['category'])) ? 'checked' : ''; ?> /> <a>Heavy Equipment</a><span class="checked"></span>
</div>
</li>
<li>
<div>
<label for="minPrice">Min Price:</label>
<input type="number" name="minPrice" id="minPrice" value="<?php echo isset($_POST['minPrice']) ? $_POST['minPrice'] : (isset($_GET['minPrice']) ? $_GET['minPrice'] : ''); ?>" />
</div>
</li>
<li>
<div>
<label for="maxPrice">Max Price:</label>
<input type="number" name="maxPrice" id="maxPrice" value="<?php echo isset($_POST['maxPrice']) ? $_POST['maxPrice'] : (isset($_GET['maxPrice']) ? $_GET['maxPrice'] : ''); ?>" />
</div>
</li>
</ul>
<button type="submit">Apply</button>
</form> -->
</ul>
</div>
</div>
<!-- Sidebar Price Block -->
<div class="ec-sidebar-block">
<div class="ec-sb-title">
<h3 class="ec-sidebar-title">Price</h3>
</div>
<div class="ec-sb-block-content es-price-slider">
<div class="ec-price-filter">
<div id="ec-sliderPrice" class="filter__slider-price" data-min="0" data-max="250" data-step="10"></div>
<div class="ec-price-input">
<label class="filter__label"><input type="text" class="filter__input"></label>
<span class="ec-price-divider"></span>
<label class="filter__label"><input type="text" class="filter__input"></label>
</div>
</div>
</div>
</div>
<!-- 02-19-2024 Jun Jihad Search Filter -->
<!-- Sidebar Size Block -->
<!-- <div class="ec-sidebar-block">
<div class="ec-sb-title">

View File

@ -1,5 +1,5 @@
<?php
include "functions.php";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input = json_decode(file_get_contents('php://input'), true);