• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/base.php
  • Класс: BitrixIblockComponentBase
  • Вызов: Base::getBigDataProductIds
protected function getBigDataProductIds()
{
	$shownIds = $this->request->get('shownIds');
	if (!empty($shownIds) && is_array($shownIds))
	{
		$this->arParams['FILTER_IDS'] += $shownIds;
	}

	$this->arParams['PAGE_ELEMENT_COUNT'] = $this->request->get('count') ?: 20;
	$this->arParams['FILTER'] ??= [];
	$this->arParams['FILTER'] = $this->arParams['FILTER'] ?: ['PAYED'];
	$this->arParams['BY'] ??= '';
	$this->arParams['BY'] = $this->arParams['BY'] ?: 'AMOUNT';
	$this->arParams['PERIOD'] ??= 0;
	$this->arParams['PERIOD'] = (int)$this->arParams['PERIOD'] ?: 30;
	$this->arParams['DEPTH'] ??= 0;
	$this->arParams['DEPTH'] = (int)$this->arParams['DEPTH'] ?: 2;

	// general filter
	$this->filterFields = $this->getFilter();
	$this->filterFields['IBLOCK_ID'] = $this->arParams['IBLOCK_ID'];
	$this->prepareElementQueryFields();

	// try cloud
	$ids = $this->request->get('items') ?: array();
	if (!empty($ids))
	{
		$recommendationId = $this->request->get('rid');
		$ids = $this->filterByParams($ids, $this->arParams['FILTER_IDS']);

		foreach ($ids as $id)
		{
			$this->recommendationIdToProduct[$id] = $recommendationId;
		}
	}

	// try bestsellers
	if (MainLoader::includeModule('sale') && count($ids) < $this->arParams['PAGE_ELEMENT_COUNT'])
	{
		$ids = $this->getBestSellersRecommendation($ids);
	}

	// try most viewed
	if ($this->useCatalog && count($ids) < $this->arParams['PAGE_ELEMENT_COUNT'])
	{
		$ids = $this->getMostViewedRecommendation($ids);
	}

	// try random
	if (count($ids) < $this->arParams['PAGE_ELEMENT_COUNT'])
	{
		$ids = $this->getRandomRecommendation($ids);
	}

	// limit
	return array_slice($ids, 0, $this->arParams['PAGE_ELEMENT_COUNT']);
}