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


PHP Type::getTypesByPriority方法代码示例

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


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

示例1: _getTypeIndexers

 /**
  * Retrieve Stock Indexer Models per Product Type
  *
  * @return \Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\StockInterface[]
  */
 protected function _getTypeIndexers()
 {
     if (empty($this->_indexers)) {
         foreach ($this->_catalogProductType->getTypesByPriority() as $typeId => $typeInfo) {
             $indexerClassName = isset($typeInfo['stock_indexer']) ? $typeInfo['stock_indexer'] : '';
             $indexer = $this->_indexerFactory->create($indexerClassName)->setTypeId($typeId)->setIsComposite(!empty($typeInfo['composite']));
             $this->_indexers[$typeId] = $indexer;
         }
     }
     return $this->_indexers;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:AbstractAction.php

示例2: getTypeIndexers

 /**
  * Retrieve price indexers per product type
  *
  * @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\PriceInterface[]
  */
 public function getTypeIndexers()
 {
     if ($this->_indexers === null) {
         $this->_indexers = [];
         $types = $this->_catalogProductType->getTypesByPriority();
         foreach ($types as $typeId => $typeInfo) {
             $modelName = isset($typeInfo['price_indexer']) ? $typeInfo['price_indexer'] : get_class($this->_defaultIndexerResource);
             $isComposite = !empty($typeInfo['composite']);
             $indexer = $this->_indexerPriceFactory->create($modelName)->setTypeId($typeId)->setIsComposite($isComposite);
             $this->_indexers[$typeId] = $indexer;
         }
     }
     return $this->_indexers;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:19,代码来源:AbstractAction.php

示例3: testGetTypesByPriority

 public function testGetTypesByPriority()
 {
     $types = $this->_productType->getTypesByPriority();
     // collect the types and priority in the same order as the method returns
     $result = [];
     foreach ($types as $typeId => $type) {
         if (!isset($type['index_priority'])) {
             // possible bug: index_priority is not defined for each type
             $priority = 0;
         } else {
             $priority = (int) $type['index_priority'];
         }
         // non-composite must be before composite
         if (1 != $type['composite']) {
             $priority = -1 * $priority;
         }
         $result[$typeId] = $priority;
     }
     $expectedResult = $result;
     asort($expectedResult);
     $this->assertEquals($expectedResult, $result);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:TypeTest.php

示例4: getTypesByPriority

 /**
  * {@inheritdoc}
  */
 public function getTypesByPriority()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getTypesByPriority');
     if (!$pluginInfo) {
         return parent::getTypesByPriority();
     } else {
         return $this->___callPlugins('getTypesByPriority', func_get_args(), $pluginInfo);
     }
 }
开发者ID:HaonanXu,项目名称:der-snack-backup,代码行数:12,代码来源:Interceptor.php


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