Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Attribute Class Reference
Inheritance diagram for Attribute:
Attribute CategoryAttributeInterface Attribute EavAttributeInterface AbstractAttribute IdentityInterface AttributeInterface AbstractExtensibleModel AttributeInterface AttributeInterface CustomAttributesDataInterface MetadataObjectInterface AbstractModel CustomAttributesDataInterface CustomAttributesDataInterface MetadataObjectInterface ExtensibleDataInterface DataObject ExtensibleDataInterface ExtensibleDataInterface

Public Member Functions

 getApplyTo ()
 
 setApplyTo ($applyTo)
 
 getIsWysiwygEnabled ()
 
 setIsWysiwygEnabled ($isWysiwygEnabled)
 
 getIsHtmlAllowedOnFront ()
 
 setIsHtmlAllowedOnFront ($isHtmlAllowedOnFront)
 
 getUsedForSortBy ()
 
 setUsedForSortBy ($usedForSortBy)
 
 getIsFilterable ()
 
 setIsFilterable ($isFilterable)
 
 getIsFilterableInSearch ()
 
 getIsUsedInGrid ()
 
 getIsVisibleInGrid ()
 
 getIsFilterableInGrid ()
 
 setIsFilterableInSearch ($isFilterableInSearch)
 
 getPosition ()
 
 setPosition ($position)
 
 getIsSearchable ()
 
 setIsSearchable ($isSearchable)
 
 getIsVisibleInAdvancedSearch ()
 
 setIsVisibleInAdvancedSearch ($isVisibleInAdvancedSearch)
 
 getIsComparable ()
 
 setIsComparable ($isComparable)
 
 getIsUsedForPromoRules ()
 
 setIsUsedForPromoRules ($isUsedForPromoRules)
 
 getIsVisibleOnFront ()
 
 setIsVisibleOnFront ($isVisibleOnFront)
 
 getUsedInProductListing ()
 
 setUsedInProductListing ($usedInProductListing)
 
 getIsVisible ()
 
 setIsVisible ($isVisible)
 
 getScope ()
 
 setScope ($scope)
 
 setIsUsedInGrid ($isUsedInGrid)
 
 setIsVisibleInGrid ($isVisibleInGrid)
 
 setIsFilterableInGrid ($isFilterableInGrid)
 
- Public Member Functions inherited from Attribute
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Framework\Locale\ResolverInterface $localeResolver, DateTimeFormatterInterface $dateTimeFormatter, LockValidatorInterface $lockValidator, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 beforeSave ()
 
 afterSave ()
 
- Public Member Functions inherited from Attribute
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Framework\Locale\ResolverInterface $localeResolver, DateTimeFormatterInterface $dateTimeFormatter, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 deleteEntity ()
 
 loadEntityAttributeIdBySet ()
 
 beforeSave ()
 
 afterSave ()
 
 afterDelete ()
 
 getBackendTypeByInput ($type)
 
 getDefaultValueByInput ($type)
 
 getAttributeCodesByFrontendType ($type)
 
 getStoreLabels ()
 
 getStoreLabel ($storeId=null)
 
 getSortWeight ($setId)
 
 getIdentities ()
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractAttribute
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], \Magento\Eav\Api\Data\AttributeExtensionFactory $eavExtensionFactory=null, FrontendLabelFactory $frontendLabelFactory=null)
 
 loadByCode ($entityType, $code)
 
 getName ()
 
 setAttributeId ($data)
 
 getAttributeId ()
 
 setAttributeCode ($data)
 
 getAttributeCode ()
 
 setAttributeModel ($data)
 
 getAttributeModel ()
 
 setBackendType ($data)
 
 getBackendType ()
 
 setBackendModel ($data)
 
 getBackendModel ()
 
 setBackendTable ($data)
 
 getIsVisibleOnFront ()
 
 getDefaultValue ()
 
 setDefaultValue ($defaultValue)
 
 getAttributeSetId ()
 
 setAttributeSetId ($id)
 
 getEntityTypeId ()
 
 setEntityTypeId ($id)
 
 setEntityType ($type)
 
 getAlias ($entity=null)
 
 setName ($name)
 
 getEntityType ()
 
 setEntity ($entity)
 
 getEntity ()
 
 getEntityIdField ()
 
 getBackend ()
 
 getFrontend ()
 
 getSource ()
 
 usesSource ()
 
 isValueEmpty ($value)
 
 isAllowedEmptyTextValue ($value)
 
 isInSet ($setId)
 
 isInGroup ($setId, $groupId)
 
 getIdByCode ($entityType, $code)
 
 isStatic ()
 
 getBackendTable ()
 
 getFlatColumns ()
 
 _getFlatColumnsDdlDefinition ()
 
 getFlatIndexes ()
 
 getFlatUpdateSelect ($store=null)
 
 getIsUnique ()
 
 setIsUnique ($isUnique)
 
 getFrontendClass ()
 
 setFrontendClass ($frontendClass)
 
 getFrontendInput ()
 
 setFrontendInput ($frontendInput)
 
 getIsRequired ()
 
 setIsRequired ($isRequired)
 
 getOptions ()
 
 setOptions (array $options=null)
 
 getIsUserDefined ()
 
 setIsUserDefined ($isUserDefined)
 
 getDefaultFrontendLabel ()
 
 setDefaultFrontendLabel ($defaultFrontendLabel)
 
 getFrontendLabels ()
 
 setFrontendLabels (array $frontendLabels=null)
 
 getNote ()
 
 setNote ($note)
 
 getSourceModel ()
 
 setSourceModel ($sourceModel)
 
 getValidationRules ()
 
 setValidationRules (array $validationRules=null)
 
 setExtensionAttributes (\Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractExtensibleModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getCustomAttributes ()
 
 getCustomAttribute ($attributeCode)
 
 setCustomAttributes (array $attributes)
 
 setCustomAttribute ($attributeCode, $attributeValue)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 setId ($value)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from EavAttributeInterface
 getExtensionAttributes ()
 

Data Fields

const SCOPE_STORE = 0
 
const SCOPE_GLOBAL = 1
 
const SCOPE_WEBSITE = 2
 
const KEY_IS_GLOBAL = 'is_global'
 
- Data Fields inherited from Attribute
const MODULE_NAME = 'Magento_Catalog'
 
- Data Fields inherited from Attribute
const ATTRIBUTE_CODE_MAX_LENGTH = 60
 
const ATTRIBUTE_CODE_MIN_LENGTH = 1
 
const CACHE_TAG = 'EAV_ATTRIBUTE'
 
- Data Fields inherited from AbstractAttribute
const TYPE_STATIC = 'static'
 
const EMPTY_STRING = ''
 
- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Data Fields inherited from AttributeInterface
const ATTRIBUTE_ID = 'attribute_id'
 
const IS_UNIQUE = 'is_unique'
 
const SCOPE = 'scope'
 
const FRONTEND_CLASS = 'frontend_class'
 
const ATTRIBUTE_CODE = 'attribute_code'
 
const FRONTEND_INPUT = 'frontend_input'
 
const IS_REQUIRED = 'is_required'
 
const OPTIONS = 'options'
 
const IS_USER_DEFINED = 'is_user_defined'
 
const FRONTEND_LABEL = 'frontend_label'
 
const FRONTEND_LABELS = 'frontend_labels'
 
const NOTE = 'note'
 
const BACKEND_TYPE = 'backend_type'
 
const BACKEND_MODEL = 'backend_model'
 
const SOURCE_MODEL = 'source_model'
 
const VALIDATE_RULES = 'validate_rules'
 
const ENTITY_TYPE_ID = 'entity_type_id'
 
- Data Fields inherited from CategoryAttributeInterface
const ENTITY_TYPE_CODE = 'catalog_category'
 
- Data Fields inherited from EavAttributeInterface
const IS_WYSIWYG_ENABLED = 'is_wysiwyg_enabled'
 
const IS_HTML_ALLOWED_ON_FRONT = 'is_html_allowed_on_front'
 
const USED_FOR_SORT_BY = 'used_for_sort_by'
 
const IS_FILTERABLE = 'is_filterable'
 
const IS_FILTERABLE_IN_SEARCH = 'is_filterable_in_search'
 
const IS_USED_IN_GRID = 'is_used_in_grid'
 
const IS_VISIBLE_IN_GRID = 'is_visible_in_grid'
 
const IS_FILTERABLE_IN_GRID = 'is_filterable_in_grid'
 
const POSITION = 'position'
 
const APPLY_TO = 'apply_to'
 
const IS_SEARCHABLE = 'is_searchable'
 
const IS_VISIBLE_IN_ADVANCED_SEARCH = 'is_visible_in_advanced_search'
 
const IS_COMPARABLE = 'is_comparable'
 
const IS_USED_FOR_PROMO_RULES = 'is_used_for_promo_rules'
 
const IS_VISIBLE_ON_FRONT = 'is_visible_on_front'
 
const USED_IN_PRODUCT_LISTING = 'used_in_product_listing'
 
const IS_VISIBLE = 'is_visible'
 
const SCOPE_STORE_TEXT = 'store'
 
const SCOPE_GLOBAL_TEXT = 'global'
 
const SCOPE_WEBSITE_TEXT = 'website'
 

Additional Inherited Members

- Protected Member Functions inherited from Attribute
 _getDefaultBackendModel ()
 
 _getDefaultSourceModel ()
 
- Protected Member Functions inherited from AbstractAttribute
 getSerializer ()
 
 _construct ()
 
 _getDefaultBackendModel ()
 
 _getDefaultFrontendModel ()
 
 _getDefaultSourceModel ()
 
 _getFlatColumnsOldDefinition ()
 
- Protected Member Functions inherited from AbstractExtensibleModel
 filterCustomAttributes ($data)
 
 initializeCustomAttributes ()
 
 convertCustomAttributeValues (array &$customAttributes)
 
 getCustomAttributesCodes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
 _getExtensionAttributes ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 
- Protected Attributes inherited from Attribute
 $_eventPrefix = 'catalog_entity_attribute'
 
 $_eventObject = 'attribute'
 
 $attrLockValidator
 
- Protected Attributes inherited from Attribute
 $_eventPrefix = 'eav_entity_attribute'
 
 $_eventObject = 'attribute'
 
 $_cacheTag = self::CACHE_TAG
 
 $_localeDate
 
 $reservedAttributeList
 
 $_localeResolver
 
 $dateTimeFormatter
 
- Protected Attributes inherited from AbstractAttribute
 $_name
 
 $_entity
 
 $_backend
 
 $_frontend
 
 $_source
 
 $_attributeIdCache = []
 
 $_dataTable = null
 
 $_eavConfig
 
 $_eavTypeFactory
 
 $_storeManager
 
 $_resourceHelper
 
 $_universalFactory
 
 $optionDataFactory
 
 $dataObjectProcessor
 
 $dataObjectHelper
 
 $serializer
 
- Protected Attributes inherited from AbstractExtensibleModel
 $extensionAttributesFactory
 
 $extensionAttributes
 
 $customAttributeFactory
 
 $customAttributesCodes = null
 
 $customAttributesChanged = false
 
- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Class Attribute

@method \Magento\Eav\Api\Data\AttributeExtensionInterface getExtensionAttributes()

Definition at line 13 of file Attribute.php.

Member Function Documentation

◆ getApplyTo()

getApplyTo ( )

Retrieve apply to products array Return empty array if applied to all products

Returns
string[]

Implements EavAttributeInterface.

Definition at line 30 of file Attribute.php.

31  {
32  $applyTo = $this->_getData(self::APPLY_TO);
33  if ($applyTo) {
34  if (is_array($applyTo)) {
35  return $applyTo;
36  }
37  return explode(',', $applyTo);
38  }
39 
40  return [];
41  }

◆ getIsComparable()

getIsComparable ( )

{Whether the attribute can be compared on the frontend

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 237 of file Attribute.php.

238  {
239  return $this->_getData(self::IS_COMPARABLE);
240  }

◆ getIsFilterable()

getIsFilterable ( )

{Whether it used in layered navigation

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 118 of file Attribute.php.

119  {
120  return $this->_getData(self::IS_FILTERABLE);
121  }

◆ getIsFilterableInGrid()

getIsFilterableInGrid ( )

{Whether it is filterable in catalog product grid

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 161 of file Attribute.php.

162  {
163  return (bool)$this->_getData(self::IS_FILTERABLE_IN_GRID);
164  }

◆ getIsFilterableInSearch()

getIsFilterableInSearch ( )

{Whether it is used in search results layered navigation

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 137 of file Attribute.php.

138  {
139  return $this->_getData(self::IS_FILTERABLE_IN_SEARCH);
140  }

◆ getIsHtmlAllowedOnFront()

getIsHtmlAllowedOnFront ( )

{Whether the HTML tags are allowed on the frontend

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 80 of file Attribute.php.

81  {
82  return $this->_getData(self::IS_HTML_ALLOWED_ON_FRONT);
83  }

◆ getIsSearchable()

getIsSearchable ( )

{Whether the attribute can be used in Quick Search

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 199 of file Attribute.php.

200  {
201  return $this->_getData(self::IS_SEARCHABLE);
202  }

◆ getIsUsedForPromoRules()

getIsUsedForPromoRules ( )

{Whether the attribute can be used for promo rules

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 256 of file Attribute.php.

257  {
258  return $this->_getData(self::IS_USED_FOR_PROMO_RULES);
259  }

◆ getIsUsedInGrid()

getIsUsedInGrid ( )

{Whether it is used in catalog product grid

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 145 of file Attribute.php.

146  {
147  return (bool)$this->_getData(self::IS_USED_IN_GRID);
148  }

◆ getIsVisible()

getIsVisible ( )

{Whether attribute is visible on frontend.

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 313 of file Attribute.php.

314  {
315  return $this->_getData(self::IS_VISIBLE);
316  }

◆ getIsVisibleInAdvancedSearch()

getIsVisibleInAdvancedSearch ( )

{Whether the attribute can be used in Advanced Search

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 218 of file Attribute.php.

219  {
220  return $this->_getData(self::IS_VISIBLE_IN_ADVANCED_SEARCH);
221  }

◆ getIsVisibleInGrid()

getIsVisibleInGrid ( )

{Whether it is visible in catalog product grid

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 153 of file Attribute.php.

154  {
155  return (bool)$this->_getData(self::IS_VISIBLE_IN_GRID);
156  }

◆ getIsVisibleOnFront()

getIsVisibleOnFront ( )

{Whether the attribute is visible on the frontend

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 275 of file Attribute.php.

276  {
277  return $this->_getData(self::IS_VISIBLE_ON_FRONT);
278  }

◆ getIsWysiwygEnabled()

getIsWysiwygEnabled ( )

@codeCoverageIgnoreStart {Enable WYSIWYG flag

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 61 of file Attribute.php.

62  {
63  return $this->_getData(self::IS_WYSIWYG_ENABLED);
64  }

◆ getPosition()

getPosition ( )

{Get position

Returns
int|null
}

Implements EavAttributeInterface.

Definition at line 180 of file Attribute.php.

181  {
182  return $this->_getData(self::POSITION);
183  }

◆ getScope()

getScope ( )

{Retrieve attribute scope

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 334 of file Attribute.php.

335  {
336  $scope = $this->_getData(self::KEY_IS_GLOBAL);
337  if ($scope == self::SCOPE_GLOBAL) {
339  } elseif ($scope == self::SCOPE_WEBSITE) {
341  } else {
342  return self::SCOPE_STORE_TEXT;
343  }
344  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ getUsedForSortBy()

getUsedForSortBy ( )

{Whether it is used for sorting in product listing

Returns
bool|null
}

Implements EavAttributeInterface.

Definition at line 99 of file Attribute.php.

100  {
101  return $this->_getData(self::USED_FOR_SORT_BY);
102  }

◆ getUsedInProductListing()

getUsedInProductListing ( )

{Whether the attribute can be used in product listing

Returns
string|null
}

Implements EavAttributeInterface.

Definition at line 294 of file Attribute.php.

295  {
296  return $this->_getData(self::USED_IN_PRODUCT_LISTING);
297  }

◆ setApplyTo()

setApplyTo (   $applyTo)

Set apply to value for the element

Parameters
string[]|string
Returns
$this

Implements EavAttributeInterface.

Definition at line 49 of file Attribute.php.

50  {
51  if (is_array($applyTo)) {
52  $applyTo = implode(',', $applyTo);
53  }
54  return $this->setData(self::APPLY_TO, $applyTo);
55  }

◆ setIsComparable()

setIsComparable (   $isComparable)

Set whether the attribute can be compared on the frontend

Parameters
string$isComparable
Returns
$this

Implements EavAttributeInterface.

Definition at line 248 of file Attribute.php.

249  {
250  return $this->setData(self::IS_COMPARABLE, $isComparable);
251  }

◆ setIsFilterable()

setIsFilterable (   $isFilterable)

Set whether it used in layered navigation

Parameters
bool$isFilterable
Returns
$this

Implements EavAttributeInterface.

Definition at line 129 of file Attribute.php.

130  {
131  return $this->setData(self::IS_FILTERABLE, $isFilterable);
132  }

◆ setIsFilterableInGrid()

setIsFilterableInGrid (   $isFilterableInGrid)

Set is attribute filterable in grid

Parameters
bool | null$isFilterableInGrid
Returns
$this
Since
102.0.0

Implements EavAttributeInterface.

Definition at line 387 of file Attribute.php.

388  {
389  $this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
390  return $this;
391  }

◆ setIsFilterableInSearch()

setIsFilterableInSearch (   $isFilterableInSearch)

Set whether it is used in search results layered navigation

Parameters
bool$isFilterableInSearch
Returns
$this

Implements EavAttributeInterface.

Definition at line 172 of file Attribute.php.

173  {
174  return $this->setData(self::IS_FILTERABLE_IN_SEARCH, $isFilterableInSearch);
175  }

◆ setIsHtmlAllowedOnFront()

setIsHtmlAllowedOnFront (   $isHtmlAllowedOnFront)

Set whether the HTML tags are allowed on the frontend

Parameters
bool$isHtmlAllowedOnFront
Returns
$this

Implements EavAttributeInterface.

Definition at line 91 of file Attribute.php.

92  {
93  return $this->setData(self::IS_HTML_ALLOWED_ON_FRONT, $isHtmlAllowedOnFront);
94  }

◆ setIsSearchable()

setIsSearchable (   $isSearchable)

Whether the attribute can be used in Quick Search

Parameters
string$isSearchable
Returns
$this

Implements EavAttributeInterface.

Definition at line 210 of file Attribute.php.

211  {
212  return $this->setData(self::IS_SEARCHABLE, $isSearchable);
213  }

◆ setIsUsedForPromoRules()

setIsUsedForPromoRules (   $isUsedForPromoRules)

Set whether the attribute can be used for promo rules

Parameters
string$isUsedForPromoRules
Returns
$this

Implements EavAttributeInterface.

Definition at line 267 of file Attribute.php.

268  {
269  return $this->setData(self::IS_USED_FOR_PROMO_RULES, $isUsedForPromoRules);
270  }

◆ setIsUsedInGrid()

setIsUsedInGrid (   $isUsedInGrid)

Set is attribute used in grid

Parameters
bool | null$isUsedInGrid
Returns
$this
Since
102.0.0

Implements EavAttributeInterface.

Definition at line 369 of file Attribute.php.

370  {
371  $this->setData(self::IS_USED_IN_GRID, $isUsedInGrid);
372  return $this;
373  }

◆ setIsVisible()

setIsVisible (   $isVisible)

Set whether attribute is visible on frontend.

Parameters
bool$isVisible
Returns
$this

Implements EavAttributeInterface.

Definition at line 324 of file Attribute.php.

325  {
326  return $this->setData(self::IS_VISIBLE, $isVisible);
327  }

◆ setIsVisibleInAdvancedSearch()

setIsVisibleInAdvancedSearch (   $isVisibleInAdvancedSearch)

Set whether the attribute can be used in Advanced Search

Parameters
string$isVisibleInAdvancedSearch
Returns
$this

Implements EavAttributeInterface.

Definition at line 229 of file Attribute.php.

230  {
231  return $this->setData(self::IS_VISIBLE_IN_ADVANCED_SEARCH, $isVisibleInAdvancedSearch);
232  }

◆ setIsVisibleInGrid()

setIsVisibleInGrid (   $isVisibleInGrid)

Set is attribute visible in grid

Parameters
bool | null$isVisibleInGrid
Returns
$this
Since
102.0.0

Implements EavAttributeInterface.

Definition at line 378 of file Attribute.php.

379  {
380  $this->setData(self::IS_VISIBLE_IN_GRID, $isVisibleInGrid);
381  return $this;
382  }

◆ setIsVisibleOnFront()

setIsVisibleOnFront (   $isVisibleOnFront)

Set whether the attribute is visible on the frontend

Parameters
string$isVisibleOnFront
Returns
$this

Implements EavAttributeInterface.

Definition at line 286 of file Attribute.php.

287  {
288  return $this->setData(self::IS_VISIBLE_ON_FRONT, $isVisibleOnFront);
289  }

◆ setIsWysiwygEnabled()

setIsWysiwygEnabled (   $isWysiwygEnabled)

Set whether WYSIWYG is enabled flag

Parameters
bool$isWysiwygEnabled
Returns
$this

Implements EavAttributeInterface.

Definition at line 72 of file Attribute.php.

73  {
74  return $this->setData(self::IS_WYSIWYG_ENABLED, $isWysiwygEnabled);
75  }

◆ setPosition()

setPosition (   $position)

Set position

Parameters
int$position
Returns
$this

Implements EavAttributeInterface.

Definition at line 191 of file Attribute.php.

192  {
193  return $this->setData(self::POSITION, $position);
194  }

◆ setScope()

setScope (   $scope)

Set attribute scope

Parameters
string$scope
Returns
$this

Implements EavAttributeInterface.

Definition at line 352 of file Attribute.php.

353  {
354  if ($scope == 'global') {
355  return $this->setData(self::KEY_IS_GLOBAL, self::SCOPE_GLOBAL);
356  } elseif ($scope == 'website') {
357  return $this->setData(self::KEY_IS_GLOBAL, self::SCOPE_WEBSITE);
358  } elseif ($scope == 'store') {
359  return $this->setData(self::KEY_IS_GLOBAL, self::SCOPE_STORE);
360  } else {
361  //Ignore unrecognized scope
362  return $this;
363  }
364  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ setUsedForSortBy()

setUsedForSortBy (   $usedForSortBy)

Set whether it is used for sorting in product listing

Parameters
bool$usedForSortBy
Returns
$this

Implements EavAttributeInterface.

Definition at line 110 of file Attribute.php.

111  {
112  return $this->setData(self::USED_FOR_SORT_BY, $usedForSortBy);
113  }

◆ setUsedInProductListing()

setUsedInProductListing (   $usedInProductListing)

Set whether the attribute can be used in product listing

Parameters
string$usedInProductListing
Returns
$this

Implements EavAttributeInterface.

Definition at line 305 of file Attribute.php.

306  {
307  return $this->setData(self::USED_IN_PRODUCT_LISTING, $usedInProductListing);
308  }

Field Documentation

◆ KEY_IS_GLOBAL

const KEY_IS_GLOBAL = 'is_global'

Definition at line 22 of file Attribute.php.

◆ SCOPE_GLOBAL

const SCOPE_GLOBAL = 1

Definition at line 18 of file Attribute.php.

◆ SCOPE_STORE

const SCOPE_STORE = 0

Definition at line 16 of file Attribute.php.

◆ SCOPE_WEBSITE

const SCOPE_WEBSITE = 2

Definition at line 20 of file Attribute.php.


The documentation for this class was generated from the following file: