本文整理汇总了PHP中Mage_Catalog_Model_Resource_Eav_Attribute::usesSource方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Eav_Attribute::usesSource方法的具体用法?PHP Mage_Catalog_Model_Resource_Eav_Attribute::usesSource怎么用?PHP Mage_Catalog_Model_Resource_Eav_Attribute::usesSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Resource_Eav_Attribute
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Resource_Eav_Attribute::usesSource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAttributeWithOptions
/**
* Returns true if given attribute has options
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return bool
*/
public function isAttributeWithOptions(Mage_Catalog_Model_Resource_Eav_Attribute $attribute)
{
$model = Mage::getModel($attribute->getSourceModel());
return $attribute->usesSource() && $attribute->getBackendType() == 'int' && $model instanceof Mage_Eav_Model_Entity_Attribute_Source_Table;
}
示例2: 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';
}
示例3: _getAttributeType
/**
* Returns attribute type for indexation.
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute Attribute
*
* @return string
*/
protected function _getAttributeType($attribute)
{
$type = 'string';
if ($attribute->getBackendType() == 'int' || $attribute->getFrontendClass() == 'validate-digits') {
$type = 'integer';
} elseif ($attribute->getBackendType() == 'decimal') {
$type = 'double';
} elseif ($attribute->getSourceModel() == 'eav/entity_attribute_source_boolean') {
$type = 'boolean';
} elseif ($attribute->getBackendType() == 'datetime') {
$type = 'date';
} elseif ($attribute->usesSource() && $attribute->getSourceModel() === null) {
$type = 'integer';
} else {
if ($attribute->usesSource()) {
$type = 'string';
}
}
return $type;
}
示例4: getSearchParam
/**
* Retrieve filter array
*
* @deprecated since 1.12.0.0
*
* @param Enterprise_Search_Model_Resource_Collection $collection
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @param string|array $value
* @return array
*/
public function getSearchParam($collection, $attribute, $value)
{
if (empty($value) || isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
return false;
}
$locale = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
$languageSuffix = $this->getLanguageSuffix($locale);
$field = $attribute->getAttributeCode();
$backendType = $attribute->getBackendType();
$frontendInput = $attribute->getFrontendInput();
if ($frontendInput == 'multiselect') {
$field = 'attr_multi_' . $field;
} elseif ($backendType == 'decimal') {
$field = 'attr_decimal_' . $field;
} elseif ($frontendInput == 'select' || $frontendInput == 'boolean') {
$field = 'attr_select_' . $field;
} elseif ($backendType == 'datetime') {
$field = 'attr_datetime_' . $field;
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
if (is_array($value)) {
foreach ($value as &$val) {
if (!is_empty_date($val)) {
$date = new Zend_Date($val, $format);
$val = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
} else {
if (!is_empty_date($value)) {
$date = new Zend_Date($value, $format);
$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());
}
return array($field => $value);
}
示例5: canUseAttribute
/**
* Check attribute availability for super product creation
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return bool
*/
public function canUseAttribute(Mage_Catalog_Model_Resource_Eav_Attribute $attribute)
{
return $attribute->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL && $attribute->getIsVisible() && $attribute->getIsConfigurable() && $attribute->usesSource() && $attribute->getIsUserDefined();
}