title: Magento: Filter Configurable Product by their options
body: <p>I want to filter some configurable products by attributes that are used to create more instances of that product (size, color etc.). This means those attributes are not directly assigned to the configurable product, but their childs.</p>
  
  <p>I already have a code that filters configurable products by some attributes, but these are all assigned to the main product, and the children inherit that: designer.</p>
  
  <pre><code>$attributes_designers = $this-&gt;getRequest()-&gt;getParam('designers');   
  $attributes_colors = $this-&gt;getRequest()-&gt;getParam('color');
  $attributes_sizes = $this-&gt;getRequest()-&gt;getParam('size');
  
  
  
  $currentCategory =  Mage::getModel('catalog/layer')-&gt;getCurrentCategory(); 
  $_productCollection = $currentCategory-&gt;getProductCollection();
  
  if(count($attributes_designers)&gt;0 and !in_array("ALL",$attributes_designers)) {        
      $_productCollection-&gt;addAttributeToFilter('designer',$attributes_designers);
  }
  if(count($attributes_colors)&gt;0 and !in_array("ALL",$attributes_colors)) {        
      $_productCollection-&gt;addAttributeToFilter('color',$attributes_colors);
  }
  if(count($attributes_sizes)&gt;0 and !in_array("ALL",$attributes_sizes)) {        
      $_productCollection-&gt;addAttributeToFilter('size_apparel_eu',$attributes_sizes);
  }
  if(isset($_GET['order'])) $_productCollection-&gt;setOrder($this-&gt;getRequest()-&gt;getParam('order'), $this-&gt;getRequest()-&gt;getParam('dir'));
  
   $_productCollection-&gt;load();
  </code></pre>
  
  <p>here, the <code>color</code>, and <code>size_apparel_eu</code>, are not working, because those are not directly assigned to the product, but their children.</p>