Answer the question
In order to leave comments, you need to log in
How to organize search by titles in Bitrix?
Tell me, is it possible somehow in the bitrix:catalog.search component to search only by the headers of the infoblock elements? It is in it that bitrix:search.title is not offered.
Answer the question
In order to leave comments, you need to log in
The task is solved as follows
in init.php we insert
// Исключаем поиск по описаниям
AddEventHandler("search", "BeforeIndex", array("SearchHandlers", "BeforeIndexHandler"));
class SearchHandlers
{
function BeforeIndexHandler($arFields)
{
if($arFields["MODULE_ID"] == "iblock")
{
if(array_key_exists("BODY", $arFields) && substr($arFields["ITEM_ID"], 0, 1) != "S") // Только для элементов
{
$arFields["BODY"] = "";
}
if (substr($arFields["ITEM_ID"], 0, 1) == "S") // Только для разделов
{
$arFields['TITLE'] = "";
$arFields["BODY"] = "";
$arFields['TAGS'] = "";
}
}
return $arFields;
}
}
Remove the call to the search component, and replace the filter witharray("?NAME"=>$search_str);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question