From 6f8d87f50d47b9d3d9f92d394ac24fcbb0c5c450 Mon Sep 17 00:00:00 2001 From: divyesh000 Date: Sat, 18 May 2024 11:19:52 +0400 Subject: [PATCH 1/6] Improve pagination UI on shop page --- src/controllers/Shop.php | 2 + src/views/Shop.php | 123 +++++++++++++++++++++++++++++++-------- 2 files changed, 102 insertions(+), 23 deletions(-) diff --git a/src/controllers/Shop.php b/src/controllers/Shop.php index 0d11cf98..b3eb94b5 100644 --- a/src/controllers/Shop.php +++ b/src/controllers/Shop.php @@ -122,6 +122,8 @@ public function index(): void // Fetch all products from the database $all_products = Product::getAll(); + $this->data['all_products'] = $all_products; + // Apply filtering based on search keyword and category (existing functionality) $filtered_products = array_filter($all_products, array($this, "match_keyword")); $filtered_products = array_filter($filtered_products, array($this, "match_category")); diff --git a/src/views/Shop.php b/src/views/Shop.php index ea4cf343..9249f5b1 100644 --- a/src/views/Shop.php +++ b/src/views/Shop.php @@ -32,15 +32,68 @@ function displayProduct(Product $product): void echo << $img_alt_text -
-
$name
-
Rs $price
-
+
+
$name
+
Rs $price
+
EOL; } ?> + + +