當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config::importAttributesData方法代碼示例

本文整理匯總了PHP中Magento\Eav\Model\Config::importAttributesData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::importAttributesData方法的具體用法?PHP Config::importAttributesData怎麽用?PHP Config::importAttributesData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Eav\Model\Config的用法示例。


在下文中一共展示了Config::importAttributesData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAttributesUsedInRecommender

 /**
  * Retrieve Attributes used in product listing
  *
  * @return array
  */
 public function getAttributesUsedInRecommender()
 {
     if ($this->_usedInRecommender === null) {
         $this->_usedInRecommender = [];
         $entityType = \Magento\Catalog\Model\Product::ENTITY;
         $attributesData = $this->_getResource()->getAttributesUsedInRecommender();
         $this->_eavConfig->importAttributesData($entityType, $attributesData);
         foreach ($attributesData as $attributeData) {
             $attributeCode = $attributeData['attribute_code'];
             $this->_usedInRecommender[$attributeCode] = $this->_eavConfig->getAttribute($entityType, $attributeCode);
         }
     }
     return $this->_usedInRecommender;
 }
開發者ID:halk,項目名稱:recowise-magento2-demo,代碼行數:19,代碼來源:Config.php

示例2: getAttributeCodes

 /**
  * Retrieve attribute codes using for flat
  *
  * @return array
  */
 public function getAttributeCodes()
 {
     if ($this->_attributeCodes === null) {
         $adapter = $this->_resource->getConnection('read');
         $this->_attributeCodes = [];
         foreach ($this->_flatAttributeGroups as $attributeGroupName) {
             $attributes = $this->_attributeConfig->getAttributeNames($attributeGroupName);
             $this->_systemAttributes = array_unique(array_merge($attributes, $this->_systemAttributes));
         }
         $bind = ['backend_type' => \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::TYPE_STATIC, 'entity_type_id' => $this->getEntityTypeId()];
         $select = $adapter->select()->from(['main_table' => $this->getTable('eav_attribute')])->join(['additional_table' => $this->getTable('catalog_eav_attribute')], 'additional_table.attribute_id = main_table.attribute_id')->where('main_table.entity_type_id = :entity_type_id');
         $whereCondition = ['main_table.backend_type = :backend_type', $adapter->quoteInto('additional_table.is_used_for_promo_rules = ?', 1), $adapter->quoteInto('additional_table.used_in_product_listing = ?', 1), $adapter->quoteInto('additional_table.used_for_sort_by = ?', 1), $adapter->quoteInto('main_table.attribute_code IN(?)', $this->_systemAttributes)];
         if ($this->isAddFilterableAttributes()) {
             $whereCondition[] = $adapter->quoteInto('additional_table.is_filterable > ?', 0);
         }
         $select->where(implode(' OR ', $whereCondition));
         $attributesData = $adapter->fetchAll($select, $bind);
         $this->_eavConfig->importAttributesData($this->getEntityType(), $attributesData);
         foreach ($attributesData as $data) {
             $this->_attributeCodes[$data['attribute_id']] = $data['attribute_code'];
         }
         unset($attributesData);
     }
     return $this->_attributeCodes;
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:30,代碼來源:Indexer.php

示例3: getAttributesUsedForSortBy

 /**
  * Retrieve Attributes array used for sort by
  *
  * @return array
  */
 public function getAttributesUsedForSortBy()
 {
     if (is_null($this->_usedForSortBy)) {
         $this->_usedForSortBy = array();
         $entityType = \Magento\Catalog\Model\Product::ENTITY;
         $attributesData = $this->_getResource()->getAttributesUsedForSortBy();
         $this->_eavConfig->importAttributesData($entityType, $attributesData);
         foreach ($attributesData as $attributeData) {
             $attributeCode = $attributeData['attribute_code'];
             $this->_usedForSortBy[$attributeCode] = $this->_eavConfig->getAttribute($entityType, $attributeCode);
         }
     }
     return $this->_usedForSortBy;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:19,代碼來源:Config.php


注:本文中的Magento\Eav\Model\Config::importAttributesData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。