Aquí lo hice con 2 atributos de productos secundarios para buscar con consulta interna
$collection = $observer->getEvent()->getCollection();
// check if query is already in sql then no need to add per event
$cloneSelect = clone $collection->getSelect();
$wherePart = $cloneSelect->getPart(Zend_Db_Select::WHERE);
$excludedWherePart = 'AND (e.entity_id IN';
foreach ($wherePart as $key => $wherePartItem) {
if (strpos($wherePartItem, $excludedWherePart) !== false) {
return $this;
}
}
$resource = Mage::getSingleton('core/resource');
$_readAdapter = $resource->getConnection('core_read');
$status = Mage::getSingleton('catalog/config')->getAttribute('catalog_product', 'status');
$heightTo = Mage::getSingleton('catalog/config')->getAttribute('catalog_product', 'person_height_to');
$heightFrom = Mage::getSingleton('catalog/config')->getAttribute('catalog_product', 'person_height_from');
$categoryId = Mage::registry("current_category")->getId();
$storeId = Mage::app()->getStore()->getId();
$query = $_readAdapter->select()
->from(array('e' => $collection->getTable('catalog/product')),array())
->joinInner(array(
'at_status' => $status->getBackendTable()),
'at_status.entity_id = e.entity_id AND at_status.store_id = 0 AND at_status.attribute_id = ' .$status->getAttributeId(),
array()
)
->joinInner(array(
'at_stock' => $resource->getTableName('cataloginventory/stock_item')),
'at_stock.product_id = e.entity_id AND at_stock.is_in_stock = ' . 1,
array()
)
->joinInner(array(
'cat_index' => $collection->getTable('catalog/category_product_index')),
'cat_index.product_id = e.entity_id AND cat_index.store_id = ' . $storeId . ' AND cat_index.category_id = ' . $categoryId,
array()
)
->joinInner(array(
'at_person_height_to' => $heightTo->getBackendTable()),
'at_person_height_to.entity_id = e.entity_id AND at_person_height_to.store_id = 0 AND at_person_height_to.attribute_id = ' . $heightTo->getAttributeId(),
array()
)
->joinInner(array(
'at_person_height_from' => $heightTo->getBackendTable()),
'at_person_height_from.entity_id = e.entity_id AND at_person_height_from.store_id = 0 AND at_person_height_from.attribute_id = ' . $heightFrom->getAttributeId(),
array()
)
->where(
"e.type_id = 'simple' AND at_person_height_from.value <= " . $length . " AND at_person_height_to.value >= " . $length
)
->join(
array('link_table' => 'catalog_product_super_link'),
'link_table.product_id = e.entity_id', array('parent_id')
);
$productIds = array_map('intval', array_unique($_readAdapter->fetchCol($query)));
// add filter here with parent ids
$collection->addAttributeToFilter('entity_id', array('in' => $productIds));
Espero que esto ayude a otros y tenga una mejor idea.