/** * Return the indexed attribute value. * * @param Mage_Eav_Model_Attribute $attribute Attribute we want the value for. * @param mixed $value Raw value * @param int $storeId Store id * * @return mixed. */ protected function _getAttributeValue($attribute, $value, $storeId) { if ($attribute->usesSource()) { $inputType = $attribute->getFrontend()->getInputType(); if ($inputType == 'multiselect') { $value = explode(',', $value); } } else { $inputType = $attribute->getFrontend()->getInputType(); if ($inputType == 'price') { $value = Mage::app()->getStore($storeId)->roundPrice($value); } } if (is_string($value)) { $value = preg_replace("#\\s+#siu", ' ', trim(strip_tags($value))); } return $value; }
/** * Return the indexed attribute value. * * @param Mage_Eav_Model_Attribute $attribute Attribute we want the value for. * @param mixed $value Raw value * @param int $storeId Store id * * @return mixed. */ protected function _getAttributeValue($attribute, $value, $storeId) { if ($attribute->usesSource()) { if (!is_array($value)) { $value = explode(',', $value); } $value = array_filter($value); $value = array_values(array_unique($value)); if ($attribute->getBackendType() == 'int') { $value = array_map('intval', $value); } if (count($value) == 1) { $value = current($value); } } else { if ($attribute->getBackendType() == 'decimal') { $value = floatval($value); } else { if ($attribute->getBackendType() == 'int') { $value = intval($value); } } } return $value; }