How to get attributes and its values using single Collection in Magento?
Right now i am using below
$attributesInfo = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter(4)
->addFieldToFilter('frontend_input','multiselect')
->addSetInfo()
->getData();
to get attribute and below code to get attribute value
$product = Mage::getModel('catalog/product');
$collection = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', $attributeName);
My attributes code out put is like below
Color :
Black
Blue
Green
Brand :
Hp
Dell
Apple
Size :
12
14
16
Thanks,
Balan
How about this:
By using the
eav/configandeav/entity_typechances are you will be reusing an already loaded collection, which of course is more efficient then reloading the same data in new collections.EDIT: Updated the answer to include the attribute collection filter suggested by Aleksandr Ryabov.