• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discountcouponsmanagerbase.php
  • Класс: BitrixSaleDiscountCouponsManagerBase
  • Вызов: DiscountCouponsManagerBase::loadCouponProviders
static function loadCouponProviders()
{
	self::$couponProviders = array();
	if (!self::$onlySaleDiscount)
	{
		$eventData = array(
			'COUPON_UNKNOWN' => InternalsDiscountCouponTable::TYPE_UNKNOWN,
			'COUPON_TYPES' => InternalsDiscountCouponTable::getCouponTypes(false)
		);
		$event = new MainEvent('sale', self::EVENT_ON_BUILD_COUPON_PROVIDES, $eventData);
		$event->send();
		$resultList = $event->getResults();
		if (empty($resultList) || !is_array($resultList))
			return;
		/** @var MainEventResult $eventResult */
		foreach ($resultList as $eventResult)
		{
			if ($eventResult->getType() != MainEventResult::SUCCESS)
				continue;
			$module = (string)$eventResult->getModuleId();
			$provider = $eventResult->getParameters();
			if (empty($provider) || !is_array($provider))
				continue;
			if (empty($provider['getData']) || empty($provider['isExist']) || empty($provider['saveApplied']))
				continue;
			self::$couponProviders[] = array(
				'module' => $module,
				'getData' => $provider['getData'],
				'isExist' => $provider['isExist'],
				'saveApplied' => $provider['saveApplied'],
				'mode' => (
					isset($provider['mode']) && $provider['mode'] == self::COUPON_MODE_FULL
					? self::COUPON_MODE_FULL
					: self::COUPON_MODE_SIMPLE
				)
			);
		}
		unset($provider, $module, $eventResult, $resultList, $event, $eventData);
	}
}