S
S
Swally2021-08-24 12:30:05
Bitrix24
Swally, 2021-08-24 12:30:05

How to display general data from all infoblocks in Bitrix search?

Good afternoon everyone.
Please help me with the following question. There is an online store in which different groups of goods are presented and, accordingly, they are divided into different categories. There is already some code written, but when the search results are displayed, the products are divided into categories, and not displayed all together in a single stream.
An example on the screen:
6124baa0a6649473444440.png
Is it possible to combine the output in showItem all categories so that they are not separated, but shown all at once?

Code example:

$nameItem = $_GET['q'];
$were = $_GET['were'];

$nameItem2 = str_replace('-', '', $nameItem);
$nameItem = str_replace('-', '_', $nameItem);
if ($nameItem2 != $nameItem)
    $nameItem = array($nameItem, $nameItem2);
$arFilter = array(
    array("LOGIC" => "OR",
        "?NAME" => $nameItem,
        "?PROPERTY_ATT_PARTNUMBER" =>  $nameItem,
        "?PREVIEW_TEXT" =>  $nameItem,
        "?DETAIL_TEXT" =>  $nameItem,
        "?XML_ID" =>  $nameItem,
    ));
if ($USER->IsAdmin())
    ;
else if (
    in_array(13,$USER->GetUserGroupArray())
    || in_array( 7,$USER->GetUserGroupArray())
    || in_array( 8,$USER->GetUserGroupArray())
    || in_array( 9,$USER->GetUserGroupArray())
    || in_array(10,$USER->GetUserGroupArray())
    || in_array(11,$USER->GetUserGroupArray())
)
{
    $arFilter["PROPERTY_ATT_ODILER_VALUE"] = 1;
}
else
{
    $arFilter["PROPERTY_ATT_OROZN_VALUE"] = 1;
}
//	$arFilter["!PROPERTY_ATT_OARCHIVE_VALUE"] = 1;  
$array_iblocks="";

if ($were)
    $array_iblocks=array($were);
else
    $array_iblocks=array(45,44,43,8);

$l4_count = 0;

foreach($array_iblocks as $iblock_id)
{
    $arFilter['IBLOCK_ID'] = $iblock_id;
    $arSelect=array('IBLOCK_ID','ID');
    $rsElements = CIBlockElement::GetList($arSort, $arFilter, false, false, $arSelect);
//   $arIDs="";
    unset($arIDs);
    while($obElement = $rsElements->GetNextElement())
    {
        $l4_count++;
        $arIDs['ID'][] = $obElement->fields['ID'];
    }
<b>   showItem($iblock_id,$arIDs,'');</b>    // вводя такое значение, выводит результат, отраженный на скрине //
}

if ($l4_count == 0)
    echo '<h3>Поиск не дал результатов</h3>';

function showItem($idIBlock, $pz_arrrrFilter,$text)
{
    global $viewtype;
    global $arrrrFilter;
    global $USER;
    global $user_price_code_id;
    $arrrrFilter = $pz_arrrrFilter;

    if (empty($arrrrFilter['ID']))
        return;

    global $APPLICATION;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question