public function getSourceOptionId(Mage_Eav_Model_Entity_Attribute_Source_Interface $source, $value) { foreach ($source->getAllOptions() as $option) { if (strcasecmp($option['label'], $value) == 0) { return $option['value']; } } return null; }
/** * Return Options Hash for grid column from attribute source model * * @param Mage_Eav_Model_Entity_Attribute_Source_Interface $source * @param bool $withEmpty * @param bool $defaultValues * * @return array */ public function getOptionsHash(Mage_Eav_Model_Entity_Attribute_Source_Interface $source, $withEmpty = true, $defaultValues = false) { $options = array(); foreach ($source->getAllOptions($withEmpty, $defaultValues) as $valueArray) { $options[$valueArray['value']] = $valueArray['label']; } return $options; }