0

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 Sood Mar 8 '16 at 21:14
  • You are right but I need to show them for a pure design reason. – gianis6 Mar 8 '16 at 21:53
1

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; ?>

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.