AddEventHandler("search", "BeforeIndex", "BeforeIndexHandler");
function BeforeIndexHandler($arFields)
{
if(!CModule::IncludeModule("iblock")) return $arFields;
if($arFields["MODULE_ID"] == "iblock" && $arFields["PARAM2"] == 45)
{
$db_props2 = CIBlockElement::GetProperty(
$arFields["PARAM2"],
$arFields["ITEM_ID"],
array("sort" => "asc"),
Array("CODE" => "QUESTION"));
$db_props3 = CIBlockElement::GetProperty(
$arFields["PARAM2"],
$arFields["ITEM_ID"],
array("sort" => "asc"),
Array("CODE" => "ANSWER"));
if($ar_props2 = $db_props2->Fetch())
$arFields["TITLE"] = trim($ar_props["VALUE"]);
if($ar_props3 = $db_props3->Fetch())
$arFields["TITLE"] = trim($ar_props["VALUE"]);
}
return $arFields;
}
|