本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute_Abstract::getFrontendInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute_Abstract::getFrontendInput方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getFrontendInput怎么用?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getFrontendInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute_Abstract
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute_Abstract::getFrontendInput方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _isAttributeIndexable
protected function _isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
if ($attribute->getIsFilterable() == 0 && $attribute->getIsVisibleInAdvancedSearch() == 0) {
return false;
}
if ($attribute->getFrontendInput() != 'select' && $attribute->getFrontendInput() != 'multiselect') {
return false;
}
return true;
}
示例2: _isAllowedAttribute
/**
* Check is attribute allowed
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param array $attributes
* @return boolean
*/
protected function _isAllowedAttribute($attribute, array $filter = null)
{
if (!is_null($filter) && !(in_array($attribute->getAttributeCode(), $filter) || in_array($attribute->getAttributeId(), $filter))) {
return false;
}
return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes) && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes);
}
示例3: _isAttributeIndexable
protected function _isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
{
if ($attribute->getFrontendInput() != 'price') {
return false;
}
if ($attribute->getAttributeCode() == 'tier_price') {
return false;
}
if ($attribute->getAttributeCode() == 'minimal_price') {
return false;
}
return true;
}
示例4: _isAllowedAttribute
/**
* Check if attribute allowed
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param array $attributes
* @return boolean
*/
protected function _isAllowedAttribute($attribute)
{
return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes) && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes) && $attribute->getFrontendLabel() != "";
}
示例5: 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();
}
}
示例6: _validateAttributeWithSource
/**
* Validate attribute value for attributes with source models
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param mixed $attrValue
* @return array|bool
*/
protected function _validateAttributeWithSource(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $attrValue)
{
$errors = array();
// validate attributes with source models
if (null !== $attrValue && $attribute->getSourceModel()) {
if ('multiselect' !== $attribute->getFrontendInput() && is_array($attrValue)) {
return array('Invalid value type for ' . $attribute->getAttributeCode());
}
$possibleValues = $attribute->getSource()->getAllOptions(false);
foreach ((array) $attrValue as $value) {
if (is_scalar($value)) {
$value = (string) $value;
$isValid = false;
foreach ($possibleValues as $optionData) {
// comparison without types check is performed only when both values are numeric
$useStrictMode = !(is_numeric($value) && is_numeric($optionData['value']));
$isValid = $useStrictMode ? $value === $optionData['value'] : $value == $optionData['value'];
if ($isValid) {
break;
}
}
if (!$isValid) {
$errors[] = 'Invalid value "' . $value . '" for ' . $attribute->getAttributeCode();
}
} else {
$errors[] = 'Invalid value type for ' . $attribute->getAttributeCode();
}
}
}
return $errors ? $errors : true;
}
示例7: _prepareOptionValues
/**
* @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;
}