• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/compatible/discountcompatibility.php
  • Класс: BitrixSaleCompatibleDiscountCompatibility
  • Вызов: DiscountCompatibility::remakingDiscountResult
static function remakingDiscountResult()
{
	$basket = array();
	$delivery = array();

	if (!empty(self::$discountResult['BASKET']))
	{
		foreach (self::$discountResult['BASKET'] as $basketCode => $discountList)
		{
			if (!isset($basket[$basketCode]))
				$basket[$basketCode] = array();
			foreach ($discountList as $discount)
			{
				$basket[$basketCode][] = array(
					'DISCOUNT_ID' => $discount['DISCOUNT_ID'],
					'COUPON_ID' => $discount['COUPON_ID'],
					'APPLY' => $discount['RESULT']['APPLY'],
					'DESCR' => $discount['RESULT']['DESCR']
				);
			}
			unset($discount);
		}
		unset($basketCode, $discountList);
	}

	if (!empty(self::$discountResult['ORDER']))
	{
		foreach (self::$discountResult['ORDER'] as $discount)
		{
			if (!empty($discount['RESULT']['BASKET']))
			{
				foreach ($discount['RESULT']['BASKET'] as $basketCode => $applyList)
				{
					if (!isset($basket[$basketCode]))
						$basket[$basketCode] = array();
					$basket[$basketCode][] = array(
						'DISCOUNT_ID' => $discount['DISCOUNT_ID'],
						'COUPON_ID' => $discount['COUPON_ID'],
						'APPLY' => $applyList['APPLY'],
						'DESCR' => $applyList['DESCR']
					);
				}
				unset($basketCode, $applyList);
			}
			if (!empty($discount['RESULT']['DELIVERY']))
			{
				$delivery[] = array(
					'DISCOUNT_ID' => $discount['DISCOUNT_ID'],
					'COUPON_ID' => $discount['COUPON_ID'],
					'DELIVERY_ID' => $discount['RESULT']['DELIVERY']['DELIVERY_ID'],
					'APPLY' => $discount['RESULT']['DELIVERY']['APPLY'],
					'DESCR' => $discount['RESULT']['DELIVERY']['DESCR']
				);
			}
		}
		unset($discount);
	}

	unset($couponApply, $discountApply);
	self::$discountResult['RESULT'] = array(
		'BASKET' => $basket,
		'DELIVERY' => $delivery
	);
}