• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/discountgroup.php
  • Класс: BitrixSaleInternalsDiscountGroupTable
  • Вызов: DiscountGroupTable::getDiscountByGroups
static function getDiscountByGroups($groupList, $filter = array())
{
	$result = array();
	if (!empty($groupList) && is_array($groupList))
	{
		MainTypeCollection::normalizeArrayValuesByInt($groupList);
		if (!empty($groupList))
		{
			if (!is_array($filter))
				$filter = array();

			$groupRows = array_chunk($groupList, 500);
			foreach ($groupRows as &$row)
			{
				$filter['@GROUP_ID'] = $row;

				$groupIterator = self::getList(array(
					'select' => array('DISCOUNT_ID'),
					'filter' => $filter
				));
				while ($group = $groupIterator->fetch())
				{
					$group['DISCOUNT_ID'] = (int)$group['DISCOUNT_ID'];
					$result[$group['DISCOUNT_ID']] = true;
				}
				unset($group, $groupIterator);
			}
			unset($row, $groupRows);
			if (!empty($result))
				$result = array_keys($result);
		}
	}
	return $result;
}