• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discount/prediction/manager.php
  • Класс: BitrixSaleDiscountPredictionManager
  • Вызов: Manager::getProductData
private function getProductData($productId, array $templates = []): ?array
{
	if (is_array($productId))
	{
		$productId = array_pop($productId);
	}
	$productId = (int)$productId;
	if ($productId <= 0)
	{
		return null;
	}

	$iterator = CIBlockElement::GetList(
		[],
		['=ID' => $productId, 'CHECK_PERMISSIONS' => 'N'],
		false,
		false,
		['ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL', 'CODE', 'IBLOCK_SECTION_ID']
	);
	if (!empty($templates['PRODUCT_URL']))
	{
		$iterator->SetUrlTemplates($templates['PRODUCT_URL']);
	}
	$row = $iterator->GetNext();
	unset($iterator);
	if (empty($row))
	{
		return null;
	}
	return [
		'#NAME#' => $row['~NAME'],
		'#LINK#' => $row['~DETAIL_PAGE_URL']
	];
}