• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discountbase.php
  • Класс: BitrixSaleDiscountBase
  • Вызов: DiscountBase::calculateFull
protected function calculateFull()
{
	$result = new Result;
	if (!$this->isBasketNotEmpty())
		return $result;

	$this->discountIds = array();
	DiscountActions::setUseMode(
		DiscountActions::MODE_CALCULATE,
		array(
			'USE_BASE_PRICE' => $this->saleOptions['USE_BASE_PRICE'],
			'SITE_ID' => $this->orderData['SITE_ID'],
			'CURRENCY' => $this->orderData['CURRENCY']
		)
	);

	$this->fillEmptyDiscountResult();
	$this->getRoundForBasePrices();
	$this->checkBasketDiscounts();

	/** @var DiscountCouponsManager $couponClassName */
	$couponClassName = $this->getDiscountCouponClassName();
	$couponClassName::clearApply();
	$basketDiscountResult = $this->calculateFullBasketDiscount();
	if (!$basketDiscountResult->isSuccess())
		$result->addErrors($basketDiscountResult->getErrors());
	unset($basketDiscountResult);
	if (!$result->isSuccess())
		return $result;

	if ($this->isRoundMode(self::ROUND_MODE_BASKET_DISCOUNT))
		$this->roundFullBasketPrices();

	if (!$this->isBasketLastDiscount())
	{
		$this->loadDiscountByUserGroups();
		$this->loadDiscountList();
		$executeResult = $this->executeDiscountList();
		if (!$executeResult->isSuccess())
			$result->addErrors($executeResult->getErrors());
		unset($executeResult);
		if (!$result->isSuccess())
			return $result;
	}

	if ($this->isRoundMode(self::ROUND_MODE_FINAL_PRICE))
		$this->roundFullBasketPrices();

	return $result;
}