1

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.

3
  • Any reason why you can't just assign the products to both categories? Nov 26, 2014 at 12:34
  • Hi Jonathan. Thanks for taking the time to read this. The reason is that there are hundreds of products in each category and for somebody to go through and assign and set the order of these is not very practical when there are hundreds of categories. Nov 27, 2014 at 9:54
  • Also maintaining the categories going forward would double up the work for a member of staff managing the category data. Nov 27, 2014 at 9:54

1 Answer 1

1

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 .

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.