I edited my question with the almost solution, but I need a bit of help to finish it off. Hope someone can help.
--
I only want the “Configurable Products” to appear in the grid and list view. This is really easy by setting the Associated Products to “Not Visible Individually”.
What I actually would like to do is that as soon as the customer starts to “filter” on "Size or Colour" attributes the Associated Products DO show up at that point.
Is this at any way possible?
For instance: T-shirt is main configurable product
- Large in Yellow is a simple Associated Product
- XLarge in Yellow is a simple Associated Product
- XXLarge in Yellow is a simple Associated Product
- Large in Green is a simple Associated Product
- XLarge in Green is a simple Associated Product
- XXLarge in Green is a simple Associated Product
As soon as you view the category you just see:
- “T-shirt” product.
When someone clicks a on the “Green” filter, the category show:
- T-shirt main product
- Large in Green is a simple Associated Product
- XLarge in Green is a simple Associated Product
- XXLarge in Green is a simple Associated Product
OR if someone clicks the XLarge filter, the category show:
- T-shirt main product
- XLarge in Yellow is a simple Associated Product
- XLarge in Green is a simple Associated Product
Anyone who can help?
EDIT!!!
I just got an Idea! Maybe someone can fill me in on this?
Maybe I should just add ALL the child (simple) products also to category.
I can check if a filter is set using:
$this->getRequest()->getParam('colours')
If the filter is set I can us the standard code:
$_productCollection=$this->getLoadedProductCollection();
If the filter is NOT set I only want to get the configurables
$_productCollection=$this->getLoadedProductCollection()->addAttributeToFilter('type_id', 'configurable');
Can anybody maybe fill me in on that last issue, how to ONLY get the configurable products? It seems that it this one doesn't work properly.