• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/discount/discountmanager.php
  • Класс: BitrixCatalogDiscountDiscountManager
  • Вызов: DiscountManager::extendProductIdsToOffer
static function extendProductIdsToOffer(array $productIds): array
{
	static $cache = [];

	Collection::normalizeArrayValuesByInt($productIds);
	if (empty($productIds))
		return [];
	$key = md5(implode('|', $productIds));

	if(!isset($cache[$key]))
	{
		$extendedList = array_combine($productIds, $productIds);
		foreach(CCatalogSku::getOffersList($productIds) as $mainProduct)
		{
			foreach(array_keys($mainProduct) as $offerId)
			{
				if(!isset($extendedList[$offerId]))
				{
					$extendedList[$offerId] = $offerId;
				}
			}
		}

		$cache[$key] = $extendedList;
	}

	return $cache[$key];
}