How would I go about modifying layered navigation to only look at attributes on the parent configurable product, and not the child?

Child and parent products both have the attribute set and it is used in other places. For example, products all have a color, including the parent. The parent's color isn't always the same as the child's, but it is indicative of the default color. When we filter to a specific color we only want to show items where the parent is set to that default color. Configurable products are visible and simple (child) products are hidden. There are some individual simple products which are not children and are visible which must also remain functional.

  • Hi Matt. Can you clarify this? You state: 'When we filter to a specific color we only want to show items where the parent is set to that default color. Configurable products are visible and simple (child) products are hidden.' - Are you thus saying that when you filter, the hidden simples are also appearing on the filter? That in itself is (as far as I know) incorrect. they are hidden, thus should not be filterable by default. A bit confused in this question.
    – ProxiBlue
    Jul 3, 2013 at 6:21
  • I am fairly sure that a configurable (parent) does not have the configurable options(s) available to be set. If you see an administrable "Color" attribute at the parent level, it is a different attribute than the attribute of the same name which is assigned to the simple (child) products. Remember that it is the attribute's attribute_code which is unique, not the frontend_label.
    – benmarks
    Jul 3, 2013 at 11:46
  • Color isn't a configurable option. Jul 3, 2013 at 16:50
  • Matt did you find a solution to this problem? Jul 23, 2013 at 14:23
  • Not a great one. I'm sure it could be done by rewriting things. I ended up duplicating the attribute and only applying it to parent configurable products / individually visible simple products. If I was to approach it again (lacking the budget for a full fix) I would probably built something into the admin panel to update the "copy" attribute automatically when the base one is updated, and to hide the "copy" attribute from the admin. Jul 28, 2013 at 22:13

1 Answer 1


With the caveat that layered navigation changes are always more complicated than they seem, the product collection for the layered navigation is instantiated in

#File: app/code/core/Mage/Catalog/Model/Layer.php
public function getProductCollection()
    if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) {
        $collection = $this->_productCollections[$this->getCurrentCategory()->getId()];
    } else {
        $collection = $this->getCurrentCategory()->getProductCollection();
        $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection;
    return $collection;

It also has its default filters added in

#File: app/code/core/Mage/Catalog/Model/Layer.php
public function prepareProductCollection($collection)


    return $this;

And an intriguingly named getFilterableAttributes

#File: app/code/core/Mage/Catalog/Model/Layer.php
public function getFilterableAttributes()
    $setIds = $this->_getSetIds();
    if (!$setIds) {
        return array();
    /** @var $collection Mage_Catalog_Model_Resource_Product_Attribute_Collection */
    $collection = Mage::getResourceModel('catalog/product_attribute_collection');
        ->setOrder('position', 'ASC');
    $collection = $this->_prepareAttributeCollection($collection);

    return $collection;

A rewrite of any one of those methods would be a good place to start (adding an type=configurable filter, restricting the filterable attributes, etc.)

  • Having obtained the collection here, what's the most efficient logic to identify and remove products that have been included because their parents are in the category? Jul 8, 2016 at 12:53
  • ...and would it be better to do it at the indexing stage? Trying to figure out where. I've found it in the fulltext search index, but not in the catalog-product index yet. Jul 8, 2016 at 12:54

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.