Get attribute option labels

Tweet, share & co

tweet fb share g+ share

Tags


Description

code to get attribute option labels

Code

public function getOptionsLabels($attribute_code)
{
	$options = Mage::getModel('eav/entity_attribute')
		->loadByCode('catalog_product', $attribute_code)
		->getSource()->getAllOptions(true, true);

	$labels = array();
	foreach($options as $option) {
		if (trim($option['label']) != '') {
		   $labels[] = $option['label'];
		}
	}
	return $labels;
}

Comments