I think an optimal solution for this would entail that a product collection for a given subcategory includes products belonging to its parent category, if the subcategory is flagged to allow such behavior.
Essentially, it comes down to adding an additional category (parent) filter to the product collection when you're on category 1.675
, so that products in both 1
and 1.675
show up on. Here are the steps.
Create a category yes/no attribute. Something like
include_parent_products
/"Include parent products on display?". Once added, go to the category manage page for1.675
and flag ityes
.Rewrite
Mage_Catalog_Model_Layer::getProductCollection
to load a modified collection if setting in step 1 is true.$displayParentProducts = $this->getCurrentCategory()->getIncludeParentProducts(); if ($displayParentProducts) { $collection = $this->getCurrentCategory()->getProductCollectionIncludingParents(); } else { $collection = $this->getCurrentCategory()->getProductCollection(); }
Rewrite/Create a new method
Mage_Catalog_Model_Category::getProductCollectionIncludingParents
.public function getProductCollection() { $parentCategory = ...; // Find parent category $collection = Mage::getResourceModel('catalog/product_collection') ->setStoreId($this->getStoreId()) ->addCategoryFilter($this) ->addCategoryFilter($parentCategory) ; return $collection; }
With the above completed, category 1.675
will notnow display its products and its parent's as well.