本文整理汇总了PHP中Mage_Catalog_Model_Resource_Eav_Attribute::getFrontendInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Eav_Attribute::getFrontendInput方法的具体用法?PHP Mage_Catalog_Model_Resource_Eav_Attribute::getFrontendInput怎么用?PHP Mage_Catalog_Model_Resource_Eav_Attribute::getFrontendInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Resource_Eav_Attribute
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Resource_Eav_Attribute::getFrontendInput方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGcontentAttributeType
/**
* Return Google Content Attribute Type By Product Attribute
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string Google Content Attribute Type
*/
public function getGcontentAttributeType($attribute)
{
$typesMapping = array('price' => self::ATTRIBUTE_TYPE_FLOAT, 'decimal' => self::ATTRIBUTE_TYPE_INT);
if (isset($typesMapping[$attribute->getFrontendInput()])) {
return $typesMapping[$attribute->getFrontendInput()];
} elseif (isset($typesMapping[$attribute->getBackendType()])) {
return $typesMapping[$attribute->getBackendType()];
} else {
return self::ATTRIBUTE_TYPE_TEXT;
}
}
示例2: _getSearchParam
/**
* Retrieve filter array
*
* @param Enterprise_Search_Model_Resource_Collection $collection
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @param string|array $value
* @return array
*/
protected function _getSearchParam($collection, $attribute, $value)
{
if (empty($value) || isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
return false;
}
$localeCode = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
$languageCode = Mage::helper('enterprise_search')->getLanguageCodeByLocaleCode($localeCode);
$languageSuffix = $languageCode ? '_' . $languageCode : '';
$field = $attribute->getAttributeCode();
$backendType = $attribute->getBackendType();
$frontendInput = $attribute->getFrontendInput();
if ($frontendInput == 'multiselect') {
$field = 'attr_multi_' . $field;
} elseif ($frontendInput == 'select' || $frontendInput == 'boolean') {
$field = 'attr_select_' . $field;
} elseif ($backendType == 'decimal') {
$field = 'attr_decimal_' . $field;
} elseif ($backendType == 'datetime') {
$field = 'attr_datetime_' . $field;
if (is_array($value)) {
foreach ($value as &$val) {
if (!is_empty_date($val)) {
$date = new Zend_Date($val, Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
$val = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
} else {
if (!is_empty_date($value)) {
$date = new Zend_Date($value, Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
$value = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
} elseif (in_array($backendType, $this->_textFieldTypes)) {
$field .= $languageSuffix;
}
if ($attribute->usesSource()) {
$attribute->setStoreId(Mage::app()->getStore()->getId());
foreach ($value as &$val) {
$val = $attribute->getSource()->getOptionText($val);
}
}
if (empty($value)) {
return array();
} else {
return array($field => $value);
}
}
示例3: getGbaseAttributeType
/**
* Return Google Base Attribute Type By Product Attribute
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string Google Base Attribute Type
*/
public function getGbaseAttributeType($attribute)
{
$typesMapping = array('price' => 'floatUnit', 'decimal' => 'numberUnit');
if (isset($typesMapping[$attribute->getFrontendInput()])) {
return $typesMapping[$attribute->getFrontendInput()];
} elseif (isset($typesMapping[$attribute->getBackendType()])) {
return $typesMapping[$attribute->getBackendType()];
} else {
return Mage_GoogleBase_Model_Service_Item::DEFAULT_ATTRIBUTE_TYPE;
}
}
示例4: getProductAttributeValue
/**
* Retrieve Product Attribute Value
*
* @param Mage_Catalog_Model_Product $product
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string
*/
public function getProductAttributeValue($product, $attribute)
{
if (!$product->hasData($attribute->getAttributeCode())) {
return Mage::helper('Mage_Catalog_Helper_Data')->__('N/A');
}
if ($attribute->getSourceModel() || in_array($attribute->getFrontendInput(), array('select', 'boolean', 'multiselect'))) {
//$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
$value = $attribute->getFrontend()->getValue($product);
} else {
$value = $product->getData($attribute->getAttributeCode());
}
return (string) $value == '' ? Mage::helper('Mage_Catalog_Helper_Data')->__('No') : $value;
}
示例5: isUsingOptions
/**
* Checks if attribute is using options.
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return bool
*/
public function isUsingOptions($attribute)
{
$sourceModel = Mage::getModel($attribute->getSourceModel());
$backendType = $attribute->getBackendType();
return $attribute->usesSource() && ($backendType == 'int' && $sourceModel instanceof Mage_Eav_Model_Entity_Attribute_Source_Table) || $backendType == 'varchar' && $attribute->getFrontendInput() == 'multiselect';
}
示例6: getProductAttributeValue
/**
* Retrieve Product Attribute Value
*
* @param Mage_Catalog_Model_Product $product
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string
*/
public function getProductAttributeValue($product, $attribute)
{
if (!$product->hasData($attribute->getAttributeCode())) {
return ' ';
}
if ($attribute->getSourceModel() || in_array($attribute->getFrontendInput(), array('select', 'boolean', 'multiselect'))) {
//$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
$value = $attribute->getFrontend()->getValue($product);
} else {
$value = $product->getData($attribute->getAttributeCode());
}
return $value ? $value : ' ';
}
示例7: getAttributeSolrFieldName
/**
* Retrieve attribute field's name for sorting
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
*
* @return string
*/
public function getAttributeSolrFieldName($attribute)
{
$attributeCode = $attribute->getAttributeCode();
if ($attributeCode == 'score') {
return $attributeCode;
}
$field = $attributeCode;
$backendType = $attribute->getBackendType();
$frontendInput = $attribute->getFrontendInput();
if ($frontendInput == 'multiselect') {
$field = 'attr_multi_' . $field;
} elseif ($frontendInput == 'select' || $frontendInput == 'boolean') {
$field = 'attr_select_' . $field;
} elseif ($backendType == 'decimal') {
$field = 'attr_decimal_' . $field;
} elseif (in_array($backendType, $this->_textFieldTypes)) {
$locale = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
$languageCode = $this->getLanguageCodeByLocaleCode($locale);
$languageSuffix = $languageCode ? '_' . $languageCode : '';
$field .= $languageSuffix;
}
return $field;
}