• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discount/prediction/manager.php
  • Класс: BitrixSaleDiscountPredictionManager
  • Вызов: Manager::getFirstPredictionTextByProduct
public function getFirstPredictionTextByProduct(Basket $basket, array $product, array $options = []): ?string
{
	$this->errorCollection->clear();

	if(!$this->isValidProduct($product))
	{
		return null;
	}

	$basketCopied = $basket->copy();
	$discounts = $this->getDiscounts($basketCopied);
	DiscountPresetManager::getInstance()->registerAutoLoader();
	$predictionDiscount = $this->findFirstPredictionDiscount($discounts, OrderAmount::className());

	if($predictionDiscount)
	{
		$text = $this->buildTextByPredictionDiscount($basketCopied, $predictionDiscount);
		if ($text)
		{
			return $text;
		}
	}

	$templates = (!empty($options['PAGE_TEMPLATES']) && is_array($options['PAGE_TEMPLATES']) ? $options['PAGE_TEMPLATES'] : []);

	return $this->tryToFindPredictionConnectedProducts($basket->copy(), $product, $templates);
}