Reputation: 41
Once a filter becomes active it returns 0 items thus it won't show anymore in the "SHOPPING OPTIONS". For my custom layered nav I need to fetch and show these items. I know some extension are already doing this (and providing checkboxes next to an item) but I'd like to know how to do it myself.
Upvotes: 4
Views: 6133
Reputation: 1021
In the matter of fact, its a very complex issue because you CAN'T really get the items from an active filter. This "filter" is no longer a filter, its now a state, and thus cannot give you any items (see app\design\frontend\base\default\template\catalog\layer\state.phtml
and compare it with filter.phtml). What you CAN do is fight a little bit with app\code\core\Mage\Catalog\Model\Layer
models, and especially app\code\core\Mage\Catalog\Model\Resource\Eav\Mysql4\Layer\Filter\Attribute.php
. Its a resource which does all the work with adding layers, counting products for the layers... If you're familiar with Zend Select object, and a little mysql you could quite easily achieve whatever you want with layered navigation.
As far as I know, most commercial modules use AJAX to simulate some new Layered Navigation features (they don't really mess up with it).
If you are not familiar with Magento development, layered navigation is probably the worst place to start...
Upvotes: 1
Reputation: 199
If you want your layered navigation filters to show up when the results are 0 for the filter then all you have to do is go to is edit the product attributes and set Use In Layered Navigation=Filterable (No result).
Upvotes: 1