Monday, June 18, 2012
Magento Layered navigation at home page
Follow as
1.Update XML layout via CMS > Manage Pages > Homepage > Layout Update XML box:
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
2.Modify a core method getCurrentCategory() in core/Mage/Catalog/Model/Layer.php
public function getCurrentCategory()
{
$category = $this->getData('current_category');
if (is_null($category)) {
if ($category = Mage::registry('current_category')) {
$this->setData('current_category', $category);
}
else {
$category = Mage::getModel('catalog/category')->load($this->getCurrentStore()->getRootCategoryId());
$this->setData('current_category', $category);
}
}
if($category != Mage::registry('current_category')) {
$home_category = Mage::getModel('catalog/category')->load(3);
$this->setData('current_category', $home_category);
$category = $this->getData('current_category');
//return $category;
}
return $category;
}
Labels:
Magento
Subscribe to:
Post Comments (Atom)
9 comments:
there is an error in your code in this line
Reply Deletepublic function getCurrentCategory()
Give me error code so i can help you.
DeleteGreate!
Reply DeleteThnks, It works, after trying a couple of code o other sites
Is not filtering when I apply above code. I have the newest magento 1.7.0.2
Reply Deletetry to set as a current category from any category for home page.
DeleteThanks!
Reply Delete-- Magento Developer
hello, can you help me. How to show a filter for a specific category. as here rezina.cc
Reply Deletenothing happen on my home page..please can you help me?
Reply DeleteRemember after that need to flush magento cache.
Delete