Compare commits
2 Commits
fc13003509
...
69afa41d33
Author | SHA1 | Date |
---|---|---|
MarkHipe | 69afa41d33 | |
mark H | 12a5e426b5 |
|
@ -70,21 +70,34 @@ if ($_SESSION["userId"] <> "") {
|
|||
</style>
|
||||
<script>
|
||||
function updateCartItemCount() {
|
||||
$.get("cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data, status) {
|
||||
if (data != "") {
|
||||
console.log("Data: " + data + "\nStatus: " + status);
|
||||
document.getElementById("cartItemCount").innerHTML = data;
|
||||
}
|
||||
});
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if (data !== "") {
|
||||
console.log("Data: " + data);
|
||||
document.getElementById("cartItemCount").innerHTML = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function updateWishItemCount() {
|
||||
$.get("wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data) {
|
||||
if (data != "") {
|
||||
document.getElementById("wishItemCount").innerHTML = data;
|
||||
}
|
||||
});
|
||||
function updateWishItemCount() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if (data !== "") {
|
||||
document.getElementById("wishItemCount").innerHTML = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
@ -197,143 +210,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div class="shop-pro-content">
|
||||
<div class="shop-pro-inner">
|
||||
<div class="row" id="product-container2">
|
||||
<?php
|
||||
// $simpleProducts = sddProducts();
|
||||
// $productsPerPage = 8;
|
||||
// $currentPage = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
// $startIndex = ($currentPage - 1) * $productsPerPage;
|
||||
// $endIndex = $startIndex + $productsPerPage - 1;
|
||||
// $endIndex = min($endIndex, count($simpleProducts) - 1);
|
||||
// for ($i = $startIndex; $i <= $endIndex; $i++) {
|
||||
|
||||
// // $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
// $pid = $i;
|
||||
// $vendorOfProduct = getVendorbyId($simpleProducts[$pid]['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 pro-gl-content">
|
||||
<div class="ec-product-inner" style="width: 260px;">
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $simpleProducts[$pid]["_id"]; ?>" >
|
||||
<?php
|
||||
if (isset($simpleProducts[$pid]['images'])) {
|
||||
$image_urls = explode(',', $simpleProducts[$pid]['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 280px; width: 100%;"/>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="ec-image-preview" src="assets/images/product-image/vender-upload-preview.jpg" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- <img loading="lazy" class="main-image" src="<?php echo $simpleProducts[$pid]["images"] ?>" alt="Product" /> -->
|
||||
<!-- <img loading="lazy" class="hover-image" src="<?php echo $simpleProducts[$pid]["images"] ?>" alt="Product" /> -->
|
||||
</a>
|
||||
|
||||
<div class="ec-pro-actions">
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($simpleProducts[$pid]), 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($simpleProducts[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ec-pro-content">
|
||||
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $simpleProducts[$pid]["_id"]; ?>">
|
||||
<?php echo $simpleProducts[$pid]["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> -->
|
||||
<div class="ec-pro-list-desc"> <?php echo $simpleProducts[$pid]["specifications"] ?></div>
|
||||
<span class="ec-price">
|
||||
<?php if (isset($simpleProducts[$pid]["sale_price"]) && $simpleProducts[$pid]["sale_price"] > 0) : ?>
|
||||
<span class="old-price">₱<?php echo number_format($simpleProducts[$pid]["regular_price"], 2, ".", ",") ?></span>
|
||||
<span class="new-price">₱<?php echo number_format($simpleProducts[$pid]["sale_price"], 2, ".", ",") ?></span>
|
||||
<?php elseif (isset($simpleProducts[$pid]["regular_price"]) && $simpleProducts[$pid]["regular_price"] != "") : ?>
|
||||
<span class="new-price">₱<?php echo number_format($simpleProducts[$pid]["regular_price"], 2, ".", ",") ?></span>
|
||||
|
||||
<?php elseif ($simpleProducts[$pid]["regular_price"] == "" || $simpleProducts[$pid]["regular_price"] == null) : ?>
|
||||
<span class="inquire-text"></span>
|
||||
<?php else : ?>
|
||||
<span class="inquire-text"></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="assets/images/product-image/8_2.jpg"
|
||||
data-src-hover="assets/images/product-image/8_2.jpg"
|
||||
data-tooltip="Gray"><span
|
||||
style="background-color:#e9dddd;"></span></a></li>
|
||||
<li><a href="#" class="ec-opt-clr-img"
|
||||
data-src="assets/images/product-image/8_3.jpg"
|
||||
data-src-hover="assets/images/product-image/8_3.jpg"
|
||||
data-tooltip="Orange"><span
|
||||
style="background-color:#ffd5cb;"></span></a></li>
|
||||
<li><a href="#" class="ec-opt-clr-img"
|
||||
data-src="assets/images/product-image/8_4.jpg"
|
||||
data-src-hover="assets/images/product-image/8_4.jpg"
|
||||
data-tooltip="Green"><span
|
||||
style="background-color:#92e4fd;"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// }
|
||||
// }
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Ec Pagination Start -->
|
||||
<div class="ec-pro-pagination" style="padding:10px">
|
||||
<span class="page-indicator">Showing <?php echo $startIndex + 1; ?>-<?php echo $endIndex + 1; ?> of <?php echo count($simpleProducts); ?> item(s)</span>
|
||||
<span class="page-indicator"></span>
|
||||
<ul class="ec-pro-pagination-inner" id='prod-search-pagination'>
|
||||
|
||||
<?php
|
||||
$totalPages = ceil(count($simpleProducts) / $productsPerPage);
|
||||
$maxPaginationLinks = 5;
|
||||
$startPage = max(1, $currentPage - floor($maxPaginationLinks / 2));
|
||||
$endPage = min($startPage + $maxPaginationLinks - 1, $totalPages);
|
||||
if ($startPage > 1) {
|
||||
?>
|
||||
<li><a href="?page=1">1</a></li>
|
||||
<?php
|
||||
if ($startPage > 2) {
|
||||
?>
|
||||
<li><span>...</span></li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
for ($page = $startPage; $page <= $endPage; $page++) {
|
||||
$activeClass = ($page == $currentPage) ? 'active' : '';
|
||||
?>
|
||||
<li><a class="<?php echo $activeClass; ?>" href="?page=<?php echo $page; ?>"><?php echo $page; ?></a></li>
|
||||
<?php
|
||||
}
|
||||
if ($endPage < $totalPages) {
|
||||
if ($endPage < $totalPages - 1) {
|
||||
?>
|
||||
<li><span>...</span></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li><a href="?page=<?php echo $totalPages; ?>"><?php echo $totalPages; ?></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<!-- 02-19-2024 Jun Jihad Same Day Delivery page -->
|
||||
<!-- Ec Pagination End -->
|
||||
|
|
|
@ -141,22 +141,35 @@ $filteredProducts = [];
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
function updateCartItemCount() {
|
||||
$.get("cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data, status) {
|
||||
if (data != "") {
|
||||
console.log("Data: " + data + "\nStatus: " + status);
|
||||
document.getElementById("cartItemCount").innerHTML = data;
|
||||
}
|
||||
});
|
||||
function updateCartItemCount() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if (data !== "") {
|
||||
console.log("Data: " + data);
|
||||
document.getElementById("cartItemCount").innerHTML = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function updateWishItemCount() {
|
||||
$.get("wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data) {
|
||||
if (data != "") {
|
||||
document.getElementById("wishItemCount").innerHTML = data;
|
||||
}
|
||||
});
|
||||
function updateWishItemCount() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if (data !== "") {
|
||||
document.getElementById("wishItemCount").innerHTML = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
@ -246,58 +259,7 @@ $filteredProducts = [];
|
|||
<a href="more-vendors.php" style="text-decoration: none; color: orange; font-weight: bold;">More Vendors></a>
|
||||
</div>
|
||||
<div class="row mt-4 vendor-list">
|
||||
<!-- <?php
|
||||
// $count = 0; // Initialize a counter
|
||||
// foreach ($vendorSearchResult['results'] as $vendor) {
|
||||
// if ($count < 2) {
|
||||
?> -->
|
||||
<!-- <div class="col-md-12">
|
||||
<div class="card" style="margin:5px">
|
||||
<div class="card-body">
|
||||
<div class="vendor-info" style="display: flex; align-items: center;">
|
||||
<div class="ec-catalog-vendor" style="display: inline-block;">
|
||||
<?php if (isset($vendor['vendor_image'])) : ?>
|
||||
<img loading="lazy" src="<?php echo $vendor['vendor_image']; ?>" alt="<?php echo $vendor['user_login']; ?>" class="vendor-image" style="max-width: 100px; max-height: 100px;">
|
||||
<?php else : ?>
|
||||
<img loading="lazy" src="https://api.obanana.com/images/storage/web_images/1708588564876-viber_image_2024-02-22_15-54-42-498.png" class="vendor-image-placeholder" style="max-width: 100px; max-height: 100px;">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="vendor-details" style="display:inline-block;">
|
||||
<a href="catalog-single-vendor.php?id=<?php echo $vendor['_id'] ?>">
|
||||
<h6 class="ec-pro-title" style="padding:0 30px;font-family: Poppins, sans-serif; text-decoration: none; color: #777;white-space: nowrap;text-overflow: ellipsis;display: block;font-size: 16px;font-weight: 400;">
|
||||
<?php echo $vendor['user_login']; ?>
|
||||
</h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: auto; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller Products</h6>
|
||||
<?php
|
||||
$products = productList();
|
||||
$vendorId = $vendor['_id'];
|
||||
$product = array_filter($products, function ($var) use ($vendorId) {
|
||||
return ($var['vendor_api_id'] == $vendorId);
|
||||
});
|
||||
?>
|
||||
<p><?php echo count($product); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: 5px; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller since</h6>
|
||||
<p><?php echo $vendor['date_registered']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <?php
|
||||
// }
|
||||
// $count++;
|
||||
// }
|
||||
?> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -311,138 +273,15 @@ $filteredProducts = [];
|
|||
<div class="shop-pro-inner list-view">
|
||||
<div class="row" id="product-container">
|
||||
|
||||
<?php
|
||||
// $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($filteredProducts) - 1);
|
||||
|
||||
// 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;
|
||||
// $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" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-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 loading="lazy" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" 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 loading="lazy" class="main-image" src="<?php echo $product_image ?>" alt="Product" />
|
||||
<img loading="lazy" class="hover-image" src="<?php echo $product_image ?>" alt="Product" />
|
||||
</a> -->
|
||||
<div class="ec-pro-actions" style="bottom: -36px;">
|
||||
<!-- 02-29-2024 Stacy disabling hover add to cart if there's no price -->
|
||||
<?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
|
||||
<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>
|
||||
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<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>
|
||||
|
||||
<?php else : ($product["regular_price"] == "" || $product["regular_price"] == null) ?>
|
||||
<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>
|
||||
|
||||
<?php endif; ?>
|
||||
<!-- 02-29-2024 Stacy disabling hover add to cart if there's no price -->
|
||||
|
||||
<!-- <button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($productWithoutSpecs), 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($productWithoutSpecs), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ec-pro-content">
|
||||
<!-- raymart added style for text wrap feb 29, 2024 -->
|
||||
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>" style="width: 90%; text-wrap: wrap;"><?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">₱<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
|
||||
<span class="new-price">₱<?php echo number_format($product["sale_price"], 2, ".", ",") ?></span>
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<span class="new-price">₱<?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>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// }
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Ec Pagination Start -->
|
||||
<div class="ec-pro-pagination">
|
||||
<span class="page-indicator">Showing <?php echo $startIndex + 1; ?>-<?php echo $endIndex + 1; ?> of <?php echo count($filteredProducts); ?> item(s)</span>
|
||||
<span class="page-indicator"></span>
|
||||
<ul class="ec-pro-pagination-inner " id='prod-search-pagination'>
|
||||
|
||||
<?php
|
||||
$totalPages = ceil(count($filteredProducts) / $productsPerPage);
|
||||
$maxPaginationLinks = 5;
|
||||
$startPage = max(1, $currentPage - floor($maxPaginationLinks / 2));
|
||||
$endPage = min($startPage + $maxPaginationLinks - 1, $totalPages);
|
||||
|
||||
if ($startPage > 1) {
|
||||
?>
|
||||
<li><a href="?page=1">1</a></li>
|
||||
<?php
|
||||
if ($startPage > 2) {
|
||||
?>
|
||||
<li><span>...</span></li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
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="<?php echo $paginationUrl; ?>"><?php echo $page; ?></a></li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($endPage < $totalPages) {
|
||||
if ($endPage < $totalPages - 1) {
|
||||
?>
|
||||
<li><span>...</span></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li><a href="?page=<?php echo $totalPages; ?>"><?php echo $totalPages; ?></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue