繁体   English   中英

Magento自定义过滤器方法

[英]Magento Custom filter approch

我正在magento的产品列表页面上实现自定义优化搜索功能。将使用4个属性,例如颜色,尺寸等。

为此,我创建了一个具有模块的自定义模块。

我想在产品列表目录页面上使用此块。

我试图将以下内容放在我的自定义主题中的catalog.xml中

<block type="filter/form" name="filter.form"          template="catalog/navigation/filter.phtml" />

过滤器是我的自定义模块,但不知何故。

我是否使用错误的方法,如果可以,请向我建议在产品列表页面上实施自定义过滤的步骤。

阻止config.xml中的零件

<global>
    <blocks>
        <Webonise_Filter>
            <class>Webonise_Filter_Block</class>
        </Webonise_Filter>
    </blocks>

    <helpers>
        <Webonise_Filter>
            <class>Webonise_Filter_Helper</class>
        </Webonise_Filter>
    </helpers>
</global>

我建议您将配置更改为:

<global>
    <blocks>
        <webonisefilter>
            <class>Webonise_Filter_Block</class>
        </webonisefilter>
    </blocks>

    <helpers>
        <webonisefilter>
            <class>Webonise_Filter_Helper</class>
        </webonisefilter>
    </helpers>
</global>

然后您可以使用以下命令调用您的代码块:

<block type="webonisefilter/form" name="filter.form" template="catalog/navigation/filter.phtml" />

下划线并非总是正确解释。 这个想法是从您的config.xml中获取快捷方式,并在您的layout.xml中使用它。 您需要一个名为Webonise_Filter_Block_Form的块来匹配webonisefilter / form。

暂无
暂无

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

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