Hide Product Filter

Can anybody give some guidance how to hide a filter if there is only one filterable item remaining. We use lots of filters that span many categories. There are some categories that may have only one filterable item.

For instance let's say we have a Manufacturer Filter and only Panasonic is left. Can it automatically be hidden?

Not to be confused with one result remaining. The category might have 100 items manufactured by Panasonic.

Thanks

Ken

I am afraid, it is not possible out of the box

Thanks for the response. Figure it wasn't but hoped someone else has done it and could supply the code requirements to make the change.

Hello

We prepared this addon

https://marketplace.cs-cart.com/add-ons/site-management/hidden-inactive-variant-filters.html

I think we can modify it so that it meets your expectations.

Best regards

Robert

Thanks for the response. I checked it out and it looks like it has the functionality that I am looking for. I am however not ready to purchase an addon. I did poke at your website and saved it for future reference. Looks like your addon/tools section could use some additional filters. There are 8 pages of results without a way to filter through them.

Thanks

Ken

Hello Ken

You are welcome

Best regards

Robert

Hi

Hopefully you know how to manage addons and hooks. I will just give you an idea where to modify the code and you will do the rest.

1) Get file design/themes/YOUR_THEME_NAME/templates/blocks/product_filters/original.tpl

2) Find the code:

{if $items}

{foreach from=$items item=“filter” name=“filters”}
{hook name=“blocks:product_filters_variants”}
{assign var=“filter_uid” value=“$block.block_id_$filter.filter_id”}
{assign var=“cookie_name_show_filter”



        {/if}
    {/hook}
{/hook}

{/foreach}

Then modify it as follows:

{if $items}

{foreach from=$items item=“filter” name=“filters”}
{if $filter.variants|count > 1}
{hook name=“blocks:product_filters_variants”}
{assign var=“filter_uid” value=“$block.block_id_$filter.filter_id”}
{assign var=“cookie_name_show_filter”



        {/if}
    {/hook}
{/hook}

{/if}
{/foreach}