Fetching all the options values of attribute.

Posted: June 3, 2009 in Magento

The below post show he syntax of  fetching values of attribute furniturebrand.

“furniturebrand” attribute type is combo.

Syntax ::

$product = Mage::getModel(“catalog/product”);
$attributes = Mage::getResourceModel(“eav/entity_attribute_collection”)
->addFieldToFilter(“attribute_code”, “furniturebrand”) // This can be changed to any attribute code

$attribute = $attributes->getFirstItem()->setEntity($product->getResource()); /* @var $attribute Mage_Eav_Model_Entity_Attribute */

$sortby = $attribute->getSource()->getAllOptions(false);

foreach($sortby as $sort_attribute) {

echo $sort_attribute[‘value’];


The above foreach loop is to display all the values of attribute furniturebrand.

Please reply if these information is useful to u ..

-Bijal Bhavsar 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s