本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute_Abstract::getBackendType方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute_Abstract::getBackendType方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getBackendType怎么用?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getBackendType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute_Abstract
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute_Abstract::getBackendType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareValueForSave
/**
* Prepare value for save
*
* @param mixed $value
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @return mixed
*/
protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
$type = $attribute->getBackendType();
if (($type == 'int' || $type == 'decimal' || $type == 'datetime') && $value === '') {
$value = null;
}
return parent::_prepareValueForSave($value, $attribute);
}
示例2: _prepareValueForSave
/**
* Prepare value for save
*
* @param mixed $value
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @return mixed
*/
protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
if ($attribute->getBackendType() == 'decimal') {
return Mage::app()->getLocale()->getNumber($value);
}
$backendTable = $attribute->getBackendTable();
if (!isset(self::$_attributeBackendTables[$backendTable])) {
self::$_attributeBackendTables[$backendTable] = $this->_getReadAdapter()->describeTable($backendTable);
}
$describe = self::$_attributeBackendTables[$backendTable];
return $this->_getReadAdapter()->prepareColumnValue($describe['value'], $value);
}
示例3: getAttributeType
/**
* Get attribute type for upcoming validation.
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute $attribute
* @return string
*/
public static function getAttributeType(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
if ($attribute->usesSource()) {
return $attribute->getFrontendInput() == 'multiselect' ? 'multiselect' : 'select';
} elseif ($attribute->isStatic()) {
return $attribute->getFrontendInput() == 'date' ? 'datetime' : 'varchar';
} else {
return $attribute->getBackendType();
}
}
示例4: _prepareValueForSave
/**
* Prepare value for save
*
* @param mixed $value
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @return mixed
*/
protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
if ($attribute->getBackendType() == 'decimal') {
return Mage::app()->getLocale()->getNumber($value);
}
return $value;
}
示例5: _prepareValueForSave
/**
* Prepare value for save
*
* @param mixed $value
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @return mixed
*/
protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
$type = $attribute->getBackendType();
if (($type == 'int' || $type == 'decimal' || $type == 'datetime') && $value === '') {
return null;
}
if ($type == 'decimal') {
return Mage::app()->getLocale()->getNumber($value);
}
return $value;
}
示例6: _prepareValueForDocumentSave
/**
* Ensure values are OK for numeric attributes before saving them
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute Attribute to prepare the value for
* @param mixed $value Value to be saved
*
* @return mixed The value ready for save
*/
protected function _prepareValueForDocumentSave($attribute, $value)
{
if (is_object($value)) {
$value = (string) $value;
}
if ($value != '') {
$type = strtolower($attribute->getBackendType());
// Handle numeric cast to float
$value = $this->_prepareTableValueForSave($value, $attribute->getBackendType());
if ($type == "int") {
// Ensure int storage is correct
$value = (int) $value;
}
}
return $value;
}