2

My store has numerous attributes in my layered navigation to allow customers to refine the product views/searches. On some of my categories i only have 1 attribute present. For example one of my categories - women > accessories > belts

has:

- 1 price option ($10.00 and above)
- 3 colour options (brown, tan, black)
- 1 brand option (Levi's)

How can I hide any filters that only have 1 value present. So in this case instead of the above i would only want:

- 3 colour options (brown, tan, black)

to show in the layered navigation

3

edit the file /app/design/frontend/{package}/{theme}/template/catalog/layer/view.phtml and replace this line:

 <?php if($_filter->getItemsCount()): ?>  

with

 <?php if($_filter->getItemsCount() > 1): ?>

I only see one problem with this approach.
If all your filters have only one option they you will still get the section title

<p class="block-subtitle"><?php echo $this->__('Shopping Options') ?></p>

But this can easily be overcome if you loop through the available filters and see if you have at least one that has the items count bigger than 1.

  • Helped in magento2..:) – Ketan Borada Jun 11 '18 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.