• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discount/gift/manager.php
  • Класс: BitrixSaleDiscountGiftManager
  • Вызов: Manager::getGiftedProductIdsByAppliedDiscount
private function getGiftedProductIdsByAppliedDiscount(array $discount)
{
	if(empty($discount['RESULT']['BASKET']))
	{
		return array();
	}
	$giftedProducts = array();
	foreach($discount['RESULT']['BASKET'] as $item)
	{
		if(empty($item['VALUE_PERCENT']) || $item['VALUE_PERCENT'] != 100)
		{
			continue;
		}
		//todo today we work only with catalog items. In future we will move the method to gifter and there
		//will return gifted products.
		if(empty($item['MODULE']) || $item['MODULE'] !== 'catalog')
		{
			continue;
		}
		$giftedProducts[] = $item['PRODUCT_ID'];
	}
	unset($item);

	return $giftedProducts;
}