Skip to content

Instantly share code, notes, and snippets.

@RowanBurgess-zz
Forked from pierreandreroy/all_attribute_options
Last active August 29, 2015 14:22
Show Gist options
  • Save RowanBurgess-zz/4c575dbad1eb61ee72c7 to your computer and use it in GitHub Desktop.
Save RowanBurgess-zz/4c575dbad1eb61ee72c7 to your computer and use it in GitHub Desktop.
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance) {
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment