Magento: Get all attribute values (colors, sizes, etc.)
Magento get all the attribute values you have in the store. Get all the colors and sizes values in Magento. Change the attribute name to whatever you want values for, in the below script.
require_once('app/Mage.php'); umask(0); Mage::app('admin'); //set_time_limit(0); $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); $colors = array(); foreach ($attribute->getSource()->getAllOptions(true) as $option) { $colors[] = $option['label']; } sort($colors); foreach($colors as $lbl) { echo "<span style='background-color:lightgrey'>".$lbl . "</span>"; echo "<br>"; }
Replace color with any attribute you want to get values for. Above script also sorts the result set in alphabetic order to make it easy to view all values.