Question

I am currently using the same products on 2 separate categories in my Magento store. I have managed to get category B to take category A's products by using the snippet below in the custom layout update xml field:

<reference name="product_list">
     <action method="setCategoryId"><category_id>1</category_id></action>
</reference>

However the layered navigation fails to recognise the products being pulled in from category A and returns no filters what so ever. Is there anyway that you can get the layered navigation to use the set category ID on the product_list block rather than the current category ID if its been set in the custom layout xml?

It is also worth mentioning that I am using the Amasty Improved Layered Navigation extension for my layered navigation with the layered nav being pulled into the category.products block.

Thanks in advance for any help anyone can provide on this issue.

Was it helpful?

Solution

You can rewrite the class app\code\core\Mage\Catalog\Model\Layer.php and adjust the method

public function getCurrentCategory()
{
    $category = parent::getCurrentCategory();
    if ($category->getId() == 111){
        $category = Mage::getModel('catalog/category')->load(222);
        $this->setData('current_category', $category);
    }
    return $category;
}

It will work both with the default navigation and with the mentioned plugin .

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top