How can i call attribute filters in magento catelog page
-
12-12-2019 - |
Question
I am using magento 1.9.0.1, we are using a customized theme for my website. I need to call attribute filters to particular place in catalog page, So for this requirement I am using this code for displaying filters.
echo $this->getLayout()->createBlock('catalog/layer_view')->setTemplate('catalog/layer/view.phtml')->toHtml()?>
Using this code I am able to display attributes and I am able to pass parameters also but products are not filtered can any one help me out from this.
Solution
I would advice you to add the layered view using the layout XML's instead of injecting the block directly. Also, adding 2 or more of this block in one page might cause issues.
Make sure your category is an anchor
category in the backend and via your templates local.xml
(or catalog.xml
) you can move around the block by adding it to the preferred parent
<catalog_category_layered>
<reference name="left">
<remove name="catalog.leftnav"/>
</reference>
<reference name="footer">
<block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml"/>
</reference>
</catalog_category_layered>
Above would include it in the footer, now all you have to do is add <?php echo $this->getChildHtml('catalog.leftnav');?>
to the footer.phtml
and you're done!
OTHER TIPS
$_item->getFilter()->getRequestVar()