简体   繁体   中英

Magento Custom filter approch

I am implementing a custom refine search functionality on product list page in magento There are 4 attributes which will be using like color,size etc.

for this i have created a custom module which has a block.

I want to use this block on product list catalog page.

I am trying to put following in catalog.xml in my custom theme

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

Where filter is my custom module, but somehow it is not working.

Am i going with wrong approch , if yes, Please suggest me the steps to implement custom filtering on product list page.

blocks parts in 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>

I advise you to change your config to :

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

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

And then you can call your block with :

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

The underscore is not always correctly interpreted. The idea is to get the shortcut from you config.xml and use it in your layout.xml. You need to have a block called Webonise_Filter_Block_Form to match webonisefilter/form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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