You need to rewrite how Mage_Catalog_Model_Layer
builds the attribute collection using the current product collection's attribute sets:
protected function _getSetIds()
{
$key = $this->getStateKey().'_SET_IDS';
$setIds = $this->getAggregator()->getCacheData($key);
if ($setIds === null) {
$setIds = $this->getProductCollection()->getSetIds();
$this->getAggregator()->saveCacheData($setIds, $key, $this->getStateTags());
}
return $setIds;
}
For this context, you'll want to check the product collection for grouped products and return the attribute set IDs of grouped children. These are then evaluated in getFilterableAttributes()
:
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');
$collection
->setItemObjectClass('catalog/resource_eav_attribute')
->setAttributeSetFilter($setIds)
->addStoreLabel(Mage::app()->getStore()->getId())
->setOrder('position', 'ASC');
$collection = $this->_prepareAttributeCollection($collection);
$collection->load();
return $collection;
}
You will likely need to deal with the cache key. I would develop with block caching off and then test extensively with it on.