Get All The Values Of a Attribute In Magento

Suppose you have created a custom attribute in Magento and want to display a dropdown of this attribute on the frontend. It is very easy, just follow the steps given below:

Step 1. Just Copy and Paste the below code where you want to display the dropdown into the layout file(phtml)

$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
		->setCodeFilter('computer_manufacturers') //Attribute Code you can get it from the Magento admin
$attrOptions = $attributes->getSource()->getAllOptions(false);

	<?php foreach($attrOptions as $items): ?>
		<option value="<?php echo $items['value']; ?>"><?php echo $items['label']; ?></option>
	<?php endforeach; ?>

It will display all the Computer Manufacturers in dropdown on the frontend.

Refer to the below screen shot to get the Attribute codes attributesCode.png

Want to read more regarding the custom attributes click here?

This is done, Thanks and Enjoy the reading.