I am trying to get filterable attributes of product collection after applying filter to it programmatically.
same as layered navigation idea after I apply filter to category, it just return attributes that I can filter with it. that's what I am trying to do here.
I need that to return filterable attributes after applying filter to collection to send it to mobile app via api.
$category = Mage::getModel('catalog/category')->setStoreId(1)->load(84);
$collection = $category->getProductCollection()
->setOrder('position', 'ASC')
->addAttributeToSelect('*')
->addAttributeToFilter('status', 1)
->addAttributeToFilter('visibility', 4)
->setStoreId(1);
$filtringAttributes = Array
(
(object) array
(
'label' => 'Ref Nav Doors',
'code' => 'ref_nav_doors',
'value' => 693
),
(object) array
(
'label' => 'Color',
'code' => 'color',
'value' => 5
)
);
if (!empty($filtringAttributes)) {
foreach ($filtringAttributes as $attribute) {
$key = $attribute->code;
$value = $attribute->value;
$collection->addAttributeToFilter($key, $value);
}
}