Answer the question
In order to leave comments, you need to log in
Why does the search by article number not work in Bitrix if there are special characters?
There is a search event by article:
AddEventHandler("search", "BeforeIndex", "BeforeIndexHandler");
function BeforeIndexHandler($arFields)
{
if(!CModule::IncludeModule("iblock")){
return $arFields;
}
if($arFields["MODULE_ID"] == "iblock" && $arFields["PARAM2"] == 99){ // ID инфоблока
$db_props = CIBlockElement::GetProperty( // Запросим свойства индексируемого элемента
$arFields["PARAM2"], // BLOCK_ID индексируемого свойства
$arFields["ITEM_ID"], // ID индексируемого свойства
array("sort" => "desc"), // Сортировка (можно упустить)
Array("CODE"=>"CML2_ARTICLE")); // CODE свойства (в данном случае артикул)
if($ar_props = $db_props->Fetch()){
$arFields["TITLE"] = $ar_props["VALUE"] . " " . $arFields["TITLE"];
}
$arFields["BODY"] = "";
}
return $arFields;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question