or send us a message

Hiding Bundle Child Items From Layered Navigation

Written by: Simon Smith, On: Wednesday 21st September 2016

By default, Magento will display the attributes of a bundled product in layered navigation, including the filterable attributes of the child products - whether they are optional bundle items or not. You can understand why they did this (think configurable products and their simple products attributes showing), but it's not always ideal.

We were recently asked to come up with a way to hide the child attributes of bundle products from the layered navigation on a store which is running Magento Enterprise 1.14.2, but the same logic applied to Community Edition 1.8+

First copy the following files to local app/code/local directory;


First we'll edit the the file Mage_Bundle_Model_CatalogIndex_Data_Bundle. Find this function;

protected $_haveChildren = array(

Amend the file like this;

protected $_haveChildren = array(

This will stop the index's rebuilding the links between bundle items and their children.

Now open the file Mage_Bundle_Model_Resource_Bundle and find the following function;

public function saveProductRelations($parentId, $childIds)
            ->processRelations($parentId, $childIds);
        return $this;

This function tries to add to the catlaog_product_relation table when the bundle product is saved, which we dont want so amend it to look like this;

public function saveProductRelations($parentId, $childIds)
		// PREVENT WRITING TO catalog_product_relation ON SAVE
        //    ->processRelations($parentId, $childIds);
        //return $this;
		return true;

The final step is to remove the bundle items already in the catalog_product_relation table. If you are NOT using configurable products in your store, you can go ahead and truncate the table. If you are using configurable products, you will need to generate a list of the bundle product ID's and delete them from the table. If for example your bundle product ID's were 100,101 and 102, you'd do this;

DELETE FROM catalog_product_relation WHERE parent_id in (100,101,102);

The final step now is to run a full reindex and flush your caches. Bundle product children will no longer appear in your layered navigation.

Pixie Media

We are a Devon's first and only Magento Partner Agency. With over 18 years experience, we offer complete digital solutions to ecommerce clients across the globe.

Magento Business Partner
Pixie Media - Devon's first Magento Partner Agency
Certified Magento Developers
Our Key Partners