[英]Magento - How to Add Custom Filter to Layered Navigation
I have 3 text attributes I want to create a custom products filter based on them. 我有3个文本属性,我想基于它们创建自定义产品过滤器。 The store is selling tires and we want to be able to filter by tire's size (which is those 3 attributes together)
商店正在销售轮胎,我们希望能够按轮胎的尺寸进行过滤(这是这三个属性的总和)
I already implemented the functionality and it works great BUT its core PHP hard coded in layer/view.phtml (and another external file), now I need to take the same code but make it a custom filter integrated in Magento framework. 我已经实现了该功能,并且可以很好地工作,但其核心PHP硬编码在layer / view.phtml(和另一个外部文件)中,现在我需要使用相同的代码,但是将其设为集成在Magento框架中的自定义过滤器。
I tried following this tutorial - http://www.techytalk.info/create-custom-layered-navigation-filter-magento but no lack. 我尝试按照本教程进行操作-http: //www.techytalk.info/create-custom-layered-navigation-filter-magento,但并不缺乏。
so far I created a new module but it doesn't seem to show up in the frontend (I do see it the advanced section in the backend). 到目前为止,我创建了一个新模块,但是它似乎没有出现在前端中(我确实在后端的高级部分中看到了它)。
I think the main problem right now is the config.xml file: 我认为目前的主要问题是config.xml文件:
<config>
<global>
<models>
<Companyname_Modulename>
<class>Companyname_Modulename_Model</class>
</Companyname_Modulename>
</models>
<blocks>
<Companyname_Modulename>
<class>Companyname_Modulename_Block</class>
</Companyname_Modulename>
</blocks>
<helpers>
<Companyname_Modulename>
<class>Companyname_Modulename_Helper</class>
</Companyname_Modulename>
</helpers>
</global>
Any insights? 有什么见解吗?
I think you're missing the <frontend>
options in config.xml. 我认为您缺少config.xml中的
<frontend>
选项。
<config>
<frontend>
<layout>
<updates>
<{namespace}_{module}>
<file>{module}.xml</file>
</{namespace}_{module}>
</updates>
</layout>
<router>
<{module}>
<use>standard</use>
<args>
<module>{Namespace}_{Module}</module>
<frontName>{module}</frontName>
</args>
</{module}>
</router>
</frontend>
</config>
Do you have the module declaration in the config node of your config.xml file? 在config.xml文件的config节点中是否有模块声明?
<config>
<modules>
<Companyname_Modulename>
<version>x.x.x</version>
</Companyname_Modulename>
</modules>
...
</config>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.