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

	$entityCacheKey = md5(serialize($this->discountIds));
	if (!isset($this->entityResultCache[$entityCacheKey]))
	{
		$this->entityResultCache[$entityCacheKey] = array();
		$this->entityList = RuntimeCacheDiscountCache::getInstance()->getDiscountEntities($this->discountIds);
		if (empty($this->entityList))
			return;

		$event = new MainEvent(
			'sale',
			self::EVENT_EXTEND_ORDER_DATA,
			array(
				'ORDER' => $this->orderData,
				'ENTITY' => $this->entityList
			)
		);
		$event->send();
		$this->entityResultCache[$entityCacheKey] = $event->getResults();
	}
	$resultList = $this->entityResultCache[$entityCacheKey];
	if (empty($resultList) || !is_array($resultList))
		return;
	/** @var MainEventResult $eventResult */
	foreach ($resultList as &$eventResult)
	{
		if ($eventResult->getType() != MainEventResult::SUCCESS)
			continue;

		$newData = $eventResult->getParameters();
		if (empty($newData) || !is_array($newData))
			continue;

		$this->modifyOrderData($newData);
	}
	unset($newData, $eventResult, $resultList);
}