简体   繁体   English

在Magento分层导航中,如何获取有效过滤器的所有项目?

[英]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". 一旦过滤器变为活动状态,它将返回0项,因此它将不再显示在“购物选项”中。 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. 我知道有些扩展已经在做这个(并在项目旁边提供复选框)但我想知道如何自己做。

如果您希望分层导航过滤器在过滤器的结果为0时显示,那么您只需编辑产品属性并设置在分层导航中使用=可过滤(无结果)。

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). 这个“过滤器”不再是过滤器,它现在是一个状态,因此无法为您提供任何项目(请参阅app\\design\\frontend\\base\\default\\template\\catalog\\layer\\state.phtml并将其与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 . 您可以做的是使用app\\code\\core\\Mage\\Catalog\\Model\\Layer模型,特别是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. 它是一个资源,可以完成所有工作,添加图层,为图层计算产品......如果你熟悉Zend Select对象,还有一点mysql,你可以很容易地通过分层导航实现你想要的任何东西。

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). 据我所知,大多数商业模块使用AJAX来模拟一些新的分层导航功能(他们并没有真正搞砸它)。

If you are not familiar with Magento development, layered navigation is probably the worst place to start... 如果您不熟悉Magento开发,分层导航可能是最糟糕的开始......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM