How to get all value of attribute in magento?

Get All Values Of a Attribute In Magento:-
To display dropdown attribute of all possible values of Attribute in Magento that you have created custom you can use the below given code for fetching the desired results.

$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setCodeFilter('colors') ->getFirstItem();
$attrOptions = $attributes->getSource()->getAllOptions(false);

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

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *