/** * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute * @param array|Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection $optionCollection * @return array */ protected function _prepareOptionValues(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $optionCollection) { $type = $attribute->getFrontendInput(); if ($type === 'select' || $type === 'multiselect') { $defaultValues = explode(',', $attribute->getDefaultValue()); $inputType = $type === 'select' ? 'radio' : 'checkbox'; } else { $defaultValues = array(); $inputType = ''; } $values = array(); $isSystemAttribute = is_array($optionCollection); foreach ($optionCollection as $option) { $bunch = $isSystemAttribute ? $this->_prepareSystemAttributeOptionValues($option, $inputType, $defaultValues) : $this->_prepareUserDefinedAttributeOptionValues($option, $inputType, $defaultValues); foreach ($bunch as $value) { $values[] = new Varien_Object($value); } } return $values; }