diff --git a/assets/css/style.css b/assets/css/style.css
index c5ef5ff..6f971c9 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -338,6 +338,7 @@ img {
}
.product-card-image {
+ display: block;
position: relative;
padding-top: 100%;
overflow: hidden;
diff --git a/includes/footer.php b/includes/footer.php
index 4014ce4..6cfe5a7 100644
--- a/includes/footer.php
+++ b/includes/footer.php
@@ -23,6 +23,17 @@
Company
diff --git a/includes/header.php b/includes/header.php
index 247cde7..7c44065 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -6,6 +6,7 @@
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
+header('Cache-Control: no-store, no-cache, must-revalidate, no-transform');
require_once __DIR__ . '/db.php';
require_once __DIR__ . '/../config/config.php';
diff --git a/shop.php b/shop.php
index 326ab87..31fa763 100644
--- a/shop.php
+++ b/shop.php
@@ -8,6 +8,7 @@ require_once __DIR__ . '/includes/functions.php';
// Get filters
$category = $_GET['category'] ?? '';
+$subcat = $_GET['subcat'] ?? '';
$search = $_GET['search'] ?? '';
$sort = $_GET['sort'] ?? 'newest';
$page = max(1, intval($_GET['page'] ?? 1));
@@ -21,6 +22,11 @@ if ($category) {
$params['category'] = $category;
}
+if ($subcat) {
+ $where[] = 'product_type_id = :subcat';
+ $params['subcat'] = $subcat;
+}
+
if ($search) {
$where[] = '(name LIKE :search OR description LIKE :search)';
$params['search'] = '%' . $search . '%';
@@ -42,7 +48,7 @@ $pagination = paginate($totalProducts, $page, 12);
// Get products
$products = db()->fetchAll(
- "SELECT * FROM products WHERE {$whereClause} ORDER BY {$orderBy} LIMIT :limit OFFSET :offset",
+ "SELECT p.*, pt.name AS type_name, pt.type_id AS type_slug FROM products p LEFT JOIN product_types pt ON p.product_type_id = pt.type_id WHERE {$whereClause} ORDER BY {$orderBy} LIMIT :limit OFFSET :offset",
array_merge($params, ['limit' => $pagination['per_page'], 'offset' => $pagination['offset']])
);
@@ -71,15 +77,29 @@ $productTypesList = db()->fetchAll("SELECT type_id, name, slug FROM product_type
-
-
-
All
-
-
- = htmlspecialchars(ucfirst($cat['category'])) ?>
-
-
+
+
Showing = count($products) ?> of = $totalProducts ?> products
= $category ? ' in ' . htmlspecialchars(ucfirst($category)) : '' ?>
+ = $subcatName ? ' · ' . htmlspecialchars($subcatName) : '' ?>
@@ -132,8 +167,13 @@ $productTypesList = db()->fetchAll("SELECT type_id, name, slug FROM product_type
-
-
= htmlspecialchars($product['category']) ?>
+
+
+ = htmlspecialchars($product['category'] ?? '') ?>
+
+ = $product['category'] ? ' · ' : '' ?>= htmlspecialchars($product['type_name']) ?>
+
+