In a web shop I am currently developing (CE 1.9.2.2) I would like to always show filterable attributes in the layered navigation category page, even if the category displayed holds no products. Is there a way to achieve this? Or to get a collection of all the filterable attributes?
-
The layered navigation filters in Magento are there to allow you to apply filters on the products in that category. If there are no products in the category what would the filters be applied on?– Paras SoodCommented Mar 8, 2016 at 21:14
-
You are right but I need to show them for a pure design reason.– giani.simCommented Mar 8, 2016 at 21:53
Add a comment
|
1 Answer
This is the modification that I would do if I had to do such implementation, change the following code under app/design/frontend/<your_package>/<your_theme>/catalog/layer/view.phtml
:
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<dt><?php echo $this->__($_filter->getName()) ?></dt>
<dd><?php echo $_filter->getHtml() ?></dd>
<?php endif; ?>
<?php endforeach; ?>
With:
<?php foreach ($_filters as $_filter): ?>
<dt><?php echo $this->__($_filter->getName()) ?></dt>
<dd><?php echo $_filter->getHtml() ?></dd>
<?php endforeach; ?>