*/ abstract class Mage_Eav_Model_Entity_Attribute_Source_Abstract implements Mage_Eav_Model_Entity_Attribute_Source_Interface { /** * Reference to the attribute instance * * @var Mage_Eav_Model_Entity_Attribute_Abstract */ protected $_attribute; /** * Options array * * @var array */ protected $_options = null; /** * Set attribute instance * * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute * @return Mage_Eav_Model_Entity_Attribute_Frontend_Abstract */ public function setAttribute($attribute) { $this->_attribute = $attribute; return $this; } /** * Get attribute instance * * @return Mage_Eav_Model_Entity_Attribute_Abstract */ public function getAttribute() { return $this->_attribute; } /** * Get a text for option value * * @param string|int $value * @return string|bool */ public function getOptionText($value) { $options = $this->getAllOptions(); // Fixed for tax_class_id and custom_design if (sizeof($options) > 0) foreach($options as $option) { if (isset($option['value']) && $option['value'] == $value) { return isset($option['label']) ? $option['label'] : $option['value']; } } // End if (isset($options[$value])) { return $options[$value]; } return false; } public function getOptionId($value) { foreach ($this->getAllOptions() as $option) { if (strcasecmp($option['label'], $value)==0 || $option['value'] == $value) { return $option['value']; } } return null; } /** * Add Value Sort To Collection Select * * @param Mage_Eav_Model_Entity_Collection_Abstract $collection * @param string $dir direction * @return Mage_Eav_Model_Entity_Attribute_Source_Abstract */ public function addValueSortToCollection($collection, $dir = Varien_Data_Collection::SORT_ORDER_DESC) { return $this; } /** * Retrieve flat column definition * * @return array */ public function getFlatColums() { return array(); } /** * Retrieve Indexes(s) for Flat * * @return array */ public function getFlatIndexes() { return array(); } /** * Retrieve Select For Flat Attribute update * * @param int $store * @return Varien_Db_Select|null */ public function getFlatUpdateSelect($store) { return null; } /** * Get a text for index option value * * @param string|int $value * @return string|bool */ public function getIndexOptionText($value) { return $this->getOptionText($value); } }