- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/component/base.php
- Класс: BitrixIblockComponentBase
- Вызов: Base::getBigDataServiceRequestParams
protected function getBigDataServiceRequestParams($type = '')
{
$params = array(
'uid' => ($_COOKIE['BX_USER_ID'] ?? ''),
'aid' => MainAnalyticsCounter::getAccountId(),
'count' => max($this->arParams['PAGE_ELEMENT_COUNT'] * 2, 30)
);
// random choices
if ($type === 'any_similar')
{
$possible = array('similar_sell', 'similar_view', 'similar');
$type = $possible[array_rand($possible)];
}
elseif ($type === 'any_personal')
{
$possible = array('bestsell', 'personal');
$type = $possible[array_rand($possible)];
}
elseif ($type === 'any')
{
$possible = array('similar_sell', 'similar_view', 'similar', 'bestsell', 'personal');
$type = $possible[array_rand($possible)];
}
// configure
switch ($type)
{
case 'bestsell':
$params['op'] = 'sim_domain_items';
$params['type'] = 'order';
$params['domain'] = MainContext::getCurrent()->getServer()->getHttpHost();
break;
case 'personal':
$params['op'] = 'recommend';
break;
case 'similar_sell':
$params['op'] = 'simitems';
$params['eid'] = $this->arParams['RCM_PROD_ID'];
$params['type'] = 'order';
break;
case 'similar_view':
$params['op'] = 'simitems';
$params['eid'] = $this->arParams['RCM_PROD_ID'];
$params['type'] = 'view';
break;
case 'similar':
$params['op'] = 'simitems';
$params['eid'] = $this->arParams['RCM_PROD_ID'];
break;
default:
$params['op'] = 'recommend';
}
$iblocks = array();
if (!empty($this->storage['IBLOCK_PARAMS']))
{
$iblocks = array_keys($this->storage['IBLOCK_PARAMS']);
}
else
{
$iblockList = array();
/* catalog */
$iblockIterator = CatalogCatalogIblockTable::getList(array(
'select' => array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID')
));
while ($iblock = $iblockIterator->fetch())
{
$iblock['IBLOCK_ID'] = (int)$iblock['IBLOCK_ID'];
$iblock['PRODUCT_IBLOCK_ID'] = (int)$iblock['PRODUCT_IBLOCK_ID'];
$iblockList[$iblock['IBLOCK_ID']] = $iblock['IBLOCK_ID'];
if ($iblock['PRODUCT_IBLOCK_ID'] > 0)
{
$iblockList[$iblock['PRODUCT_IBLOCK_ID']] = $iblock['PRODUCT_IBLOCK_ID'];
}
}
/* iblock */
$iblockIterator = IblockIblockSiteTable::getList(array(
'select' => array('IBLOCK_ID'),
'filter' => array('@IBLOCK_ID' => $iblockList, '=SITE_ID' => $this->getSiteId())
));
while ($iblock = $iblockIterator->fetch())
{
$iblocks[] = $iblock['IBLOCK_ID'];
}
}
$params['ib'] = join('.', $iblocks);
return $params;
}