• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Facade/Repository.php
  • Класс: BitrixCatalogv2FacadeRepository
  • Вызов: Repository::loadVariation
public function loadVariation(int $skuId): ?BaseSku
{
	$iblockId = (int)CIBlockElement::GetIBlockByID($skuId);
	if (!$iblockId)
	{
		return null;
	}

	$iblockInfo = ServiceContainer::getIblockInfo($iblockId);
	if (!$iblockInfo)
	{
		return null;
	}

	try
	{
		if ($iblockInfo->getProductIblockId() === $iblockId)
		{
			$product = $this->loadFromProductRepository($iblockId, $skuId);
			if ($product)
			{
				return $product->getSkuCollection()->getFirst();
			}
		}
		else
		{
			return $this->loadFromSkuRepository($iblockId, $skuId);
		}
	}
	catch (BitrixMainSystemException $e)
	{}

	return null;
}