From c3aad31794a1386a047c39c593a6672297dd00eb Mon Sep 17 00:00:00 2001 From: abhisheks <abhisheks@consultbop.com> Date: Thu, 14 Dec 2023 16:56:42 +0530 Subject: [PATCH] refactor: hide filters options if no facets are found --- templates/catalog/_partials/products-top.tpl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/catalog/_partials/products-top.tpl b/templates/catalog/_partials/products-top.tpl index 7d6b317..8efc5e9 100644 --- a/templates/catalog/_partials/products-top.tpl +++ b/templates/catalog/_partials/products-top.tpl @@ -29,13 +29,15 @@ <div class="flex justify-between"> <!-- Show Filters Button --> <div class="flex"> - <button id="show-filters" type="button" class="flex space-x-2 items-center"> - <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-filter" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> - <path stroke="none" d="M0 0h24v24H0z" fill="none"/> - <path d="M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z" /> - </svg> - <span> Filter </span> - </button> + {if !empty($listing.rendered_facets)} + <button id="show-filters" type="button" class="flex space-x-2 items-center"> + <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-filter" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <path d="M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z" /> + </svg> + <span> Filter </span> + </button> + {/if} </div> <!-- Sort By Dropdown --> <div class="flex max-w-[240px]">