From 810643c18a59902ada43d417d471876e68d5f1e0 Mon Sep 17 00:00:00 2001 From: Krzysiej Date: Sat, 21 Feb 2026 08:40:07 +0100 Subject: [PATCH] Start working on filtering by country --- src/Controller/CountryController.php | 25 +++++++++++++++++++++++++ templates/productList.html.twig | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/Controller/CountryController.php diff --git a/src/Controller/CountryController.php b/src/Controller/CountryController.php new file mode 100644 index 0000000..3afae33 --- /dev/null +++ b/src/Controller/CountryController.php @@ -0,0 +1,25 @@ +join('countries', 'countries.id', '=', 'products.country_id') + ->where('countryName', $country) + ->orderByDesc('starred') + ->orderByDesc('created_by') + ->get(); + + return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'country']); + } +} diff --git a/templates/productList.html.twig b/templates/productList.html.twig index 0f5f595..16970a1 100644 --- a/templates/productList.html.twig +++ b/templates/productList.html.twig @@ -63,7 +63,7 @@ href="{{ path('app_search', {'search': product.subTitle}) }}" class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }} {% if product.promotions is not null and product.promotions.hasPromotion %}PROMO: {{ product.promotions.tag }}{% endif %} - {{ product.country.countryName }} + {{ product.country.countryName }}