开发者

In Magento Layered Navigation, how do I get all items for active filters?

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.


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).


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜