本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
}