• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/product/sku.php
  • Класс: BitrixCatalogProductSku
  • Вызов: Sku::setCalculatePriceTypes
static function setCalculatePriceTypes(array &$list, $id, $iblockId, array $priceTypes)
{
	static $allPriceTypes = null;

	if ($allPriceTypes === null)
	{
		$allPriceTypes = array_keys(CatalogGroupTable::getTypeList());
	}

	if (empty($priceTypes))
	{
		$priceTypes = $allPriceTypes;
	}

	foreach ($priceTypes as $typeId)
	{
		self::$calculatePriceTypes[$typeId] = true;
	}

	if ($iblockId === null)
	{
		if (isset($list[$id]))
		{
			$iblockId = $list[$id]['IBLOCK_ID'];
		}
	}

	if (!isset($list[$id]))
	{
		$list[$id] = [
			'IBLOCK_ID' => $iblockId,
			self::ACTION_PRICE => array_fill_keys($priceTypes, true),
			self::ACTION_ELEMENT_TIMESTAMP => true,
		];
	}
	elseif (!isset($list[$id][self::ACTION_PRICE]))
	{
		if ($iblockId !== null)
		{
			$list[$id]['IBLOCK_ID'] = $iblockId;
		}
		$list[$id][self::ACTION_PRICE] = array_fill_keys($priceTypes, true);
		$list[$id][self::ACTION_ELEMENT_TIMESTAMP] = true;
	}
	else
	{
		if ($iblockId !== null)
		{
			$list[$id]['IBLOCK_ID'] = $iblockId;
		}
		foreach ($priceTypes as $typeId)
		{
			$list[$id][self::ACTION_PRICE][$typeId] = true;
		}
		$list[$id][self::ACTION_ELEMENT_TIMESTAMP] = true;
	}

	unset($typeId);
}