当前位置: 首页>>代码示例>>PHP>>正文


PHP Attribute::getAttributeCode方法代码示例

本文整理汇总了PHP中Magento\Eav\Model\Entity\Attribute::getAttributeCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Attribute::getAttributeCode方法的具体用法?PHP Attribute::getAttributeCode怎么用?PHP Attribute::getAttributeCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Eav\Model\Entity\Attribute的用法示例。


在下文中一共展示了Attribute::getAttributeCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addOptionValueToCollection

 /**
  * Add Join with option value for collection select
  *
  * @param \Magento\Eav\Model\Entity\Collection\AbstractCollection $collection
  * @param \Magento\Eav\Model\Entity\Attribute $attribute
  * @param \Zend_Db_Expr $valueExpr
  * @return $this
  */
 public function addOptionValueToCollection($collection, $attribute, $valueExpr)
 {
     $adapter = $this->_getReadAdapter();
     $attributeCode = $attribute->getAttributeCode();
     $optionTable1 = $attributeCode . '_option_value_t1';
     $optionTable2 = $attributeCode . '_option_value_t2';
     $tableJoinCond1 = "{$optionTable1}.option_id={$valueExpr} AND {$optionTable1}.store_id=0";
     $tableJoinCond2 = $adapter->quoteInto("{$optionTable2}.option_id={$valueExpr} AND {$optionTable2}.store_id=?", $collection->getStoreId());
     $valueExpr = $adapter->getCheckSql("{$optionTable2}.value_id IS NULL", "{$optionTable1}.value", "{$optionTable2}.value");
     $collection->getSelect()->joinLeft([$optionTable1 => $this->getTable('eav_attribute_option_value')], $tableJoinCond1, [])->joinLeft([$optionTable2 => $this->getTable('eav_attribute_option_value')], $tableJoinCond2, [$attributeCode => $valueExpr]);
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:20,代码来源:Option.php

示例2: getStaticAttributeFilterType

 /**
  * Determine filter type for static attribute.
  *
  * @static
  * @param \Magento\Eav\Model\Entity\Attribute $attribute
  * @return string
  */
 public static function getStaticAttributeFilterType(\Magento\Eav\Model\Entity\Attribute $attribute)
 {
     if (in_array($attribute->getAttributeCode(), ['category_ids', 'media_gallery'])) {
         return self::FILTER_TYPE_INPUT;
     }
     $columns = $attribute->getFlatColumns();
     switch ($columns[$attribute->getAttributeCode()]['type']) {
         case \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER:
         case \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT:
             $type = self::FILTER_TYPE_NUMBER;
             break;
         case \Magento\Framework\DB\Ddl\Table::TYPE_DATE:
         case \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME:
         case \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP:
             $type = self::FILTER_TYPE_DATE;
             break;
         default:
             $type = self::FILTER_TYPE_INPUT;
     }
     return $type;
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:28,代码来源:Export.php

示例3: map

 /**
  * Build attribute representation
  *
  * @param \Magento\Eav\Model\Entity\Attribute $attribute
  * @return array
  */
 public function map(\Magento\Eav\Model\Entity\Attribute $attribute)
 {
     $isUnassignable = !in_array($attribute->getAttributeCode(), $this->unassignableAttributes);
     return ['text' => $attribute->getAttributeCode(), 'id' => $attribute->getAttributeId(), 'cls' => $isUnassignable ? 'leaf' : 'system-leaf', 'allowDrop' => false, 'allowDrag' => true, 'leaf' => true, 'is_user_defined' => $attribute->getIsUserDefined(), 'is_unassignable' => $isUnassignable, 'entity_id' => $attribute->getEntityAttributeId()];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:AttributeMapper.php

示例4: setAttributeModel

 /**
  * Set attribute model to filter
  *
  * @param   \Magento\Eav\Model\Entity\Attribute $attribute
  * @return  \Magento\Catalog\Model\Layer\Filter\AbstractFilter
  */
 public function setAttributeModel($attribute)
 {
     $this->setRequestVar($attribute->getAttributeCode());
     $this->setData('attribute_model', $attribute);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:AbstractFilter.php

示例5: getAttributeFieldName

 /**
  * Retrieve attribute field name
  *
  *
  * @param Attribute $attribute
  * @return string
  */
 public function getAttributeFieldName($attribute)
 {
     $name = $attribute->getAttributeCode();
     if ($suffix = $this->getForm()->getFieldNameSuffix()) {
         $name = $this->getForm()->addSuffixToName($name, $suffix);
     }
     return $name;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:Gallery.php

示例6: setAttributeObj

 public function setAttributeObj(\Magento\Eav\Model\Entity\Attribute $obj)
 {
     $this->attributeObj = $obj;
     $this->code = $obj->getAttributeCode();
     return $this;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:6,代码来源:Relation.php

示例7: decorateFilter

 /**
  * Create filter fields for 'Filter' column.
  *
  * @param mixed $value
  * @param Attribute $row
  * @param \Magento\Framework\DataObject $column
  * @param boolean $isExport
  * @return string
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function decorateFilter($value, Attribute $row, \Magento\Framework\DataObject $column, $isExport)
 {
     $value = null;
     $values = $column->getValues();
     if (is_array($values) && isset($values[$row->getAttributeCode()])) {
         $value = $values[$row->getAttributeCode()];
     }
     $code = $row->getAttributeCode();
     if (isset($this->_filterTypeByAttrCode[$code])) {
         $filterType = $this->_filterTypeByAttrCode[$code];
     } else {
         $filterType = \Magento\ImportExport\Model\Export::getAttributeFilterType($row);
     }
     switch ($filterType) {
         case \Magento\ImportExport\Model\Export::FILTER_TYPE_SELECT:
             $cell = $this->_getSelectHtmlWithValue($row, $value);
             break;
         case \Magento\ImportExport\Model\Export::FILTER_TYPE_INPUT:
             $cell = $this->_getInputHtmlWithValue($row, $value);
             break;
         case \Magento\ImportExport\Model\Export::FILTER_TYPE_DATE:
             $cell = $this->_getDateFromToHtmlWithValue($row, $value);
             break;
         case \Magento\ImportExport\Model\Export::FILTER_TYPE_NUMBER:
             $cell = $this->_getNumberFromToHtmlWithValue($row, $value);
             break;
         default:
             $cell = __('Unknown attribute filter type');
     }
     return $cell;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:41,代码来源:Filter.php


注:本文中的Magento\Eav\Model\Entity\Attribute::getAttributeCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。