Get all the option value by attribute code in magento

Below code helpful to find a particular attribute values. Like here color is on my attribute, with below code we can get what and all colors are mapped with this attribute.

$attributeId = Mage::getResourceModel(‘eav/entity_attribute’)->getIdByCode(‘catalog_product’,’color’);
$collection = Mage::getResourceModel(‘eav/entity_attribute_option_collection’)
->setPositionOrder(‘asc’)
->setAttributeFilter($attributeId)
->setStoreFilter(0)
->load();

print_r($collection->getData());

————————————————————————————————————————————————————————————

Corner of Blog:

“International Day of Peace”

“Peace cannot be kept by force; it can only be achieved by understanding…”
Albert Einstein

——————————————————————————————————————————————————————————————

Leave a Reply