• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discountbase.php
  • Класс: BitrixSaleDiscountBase
  • Вызов: DiscountBase::loadRoundConfig
protected function loadRoundConfig()
{
	$defaultApplyMode = self::ROUND_MODE_FINAL_PRICE;
	$this->roundApplyMode = $defaultApplyMode;
	$this->roundApplyConfig = array();

	if ($this->isOrderExists() && !$this->isOrderNew() && $this->getUseMode() != self::USE_MODE_FULL)
	{
		$orderId = $this->getOrder()->getId();
		/** @var OrderDiscount $storageClassName */
		$storageClassName = $this->getOrderDiscountClassName();
		$entityData = $storageClassName::loadOrderStoredDataFromDb(
			$orderId,
			$storageClassName::STORAGE_TYPE_ROUND_CONFIG
		);
		unset($orderId);

		if (
			is_array($entityData)
			&& isset($entityData['MODE'])
		)
		{
			$this->roundApplyMode = (int)$entityData['MODE'];
			if ($this->isRoundMode(self::ROUND_MODE_SALE_DISCOUNT))
				$this->roundApplyConfig = (isset($entityData['CONFIG']) ? $entityData['CONFIG'] : array());
		}
	}

	if (
		$this->roundApplyMode != self::ROUND_MODE_BASKET_DISCOUNT
		&& $this->roundApplyMode != self::ROUND_MODE_SALE_DISCOUNT
		&& $this->roundApplyMode != self::ROUND_MODE_FINAL_PRICE
	)
		$this->roundApplyMode = null;
	if (!is_array($this->roundApplyConfig))
		$this->roundApplyConfig = array();
	unset($defaultApplyMode);
}