• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/helpers/controller/action/entity/order.php
  • Класс: BitrixSaleHelpersControllerActionEntityOrder
  • Вызов: Order::getSkuTree
static function getSkuTree(int $iblockId, int $productId): array
{
	$result = [];

	$skuRepository = Catalogv2IoCServiceContainer::getSkuRepository($iblockId);
	if ($skuRepository)
	{
		$sku = $skuRepository->getEntityById($productId);
		if ($sku)
		{
			$parentProduct = $sku->getParent();
			if ($parentProduct)
			{
				/** @var CatalogComponentSkuTree $skuTree */
				$skuTree = Catalogv2IoCServiceContainer::make('sku.tree', ['iblockId' => $iblockId]);

				$parentProductId = $parentProduct->getId();
				$skuId = $sku->getId();

				$tree = $skuTree->loadJsonOffers([$parentProductId => $skuId]);
				if (isset($tree[$parentProductId][$skuId]))
				{
					$result = [
						'TREE' => $tree[$parentProductId][$skuId],
						'PARENT_PRODUCT_ID' => $parentProductId,
					];
				}
			}
		}
	}

	return $result;
}