public static function searchServices($query, $nocache = false) { global $USER; $arFilter = array("IBLOCK_ID" => DrclinicsHelper::IBLOCK_SERVICES_ID, "ACTIVE" => 'Y', "NAME" => "%" . $query . "%"); $arSelectFields = array("IBLOCK_ID", "IBLOCK_SECTION_ID", "ID", "NAME", "CODE", "DETAIL_PAGE_URL"); $arServices = DrclinicsHelper::getValueFromCache("get_ib_items_list", array($arFilter, $arSelectFields, true), $nocache); $results = array(); foreach ($arServices as $arr_item) { if (!intval($arr_item["ID"])) { continue; } $arr_item["NAME"] = trim($arr_item["NAME"]); $results[$arr_item["NAME"]] = array("IS_SERVICE" => true, "NAME" => $arr_item["NAME"], "NAME_TEXT" => $arr_item["PRICE_STR_VALUE"] ? $arr_item["NAME"] . " — " . $arr_item["PRICE_STR_VALUE"] : $arr_item["NAME"], "VALUE" => $arr_item["ID"], "URL" => $arr_item["DETAIL_PAGE_URL"], "PRICE" => $arr_item["PRICE_VALUE"]); } ksort($results); $results = array_values($results); return $results; }
} } $top_sections = array(); foreach ($sections as $r_item) { if (!isset($top_sections[$r_item["IBLOCK_SECTION_ID"]])) { if ($r_item["IBLOCK_SECTION_ID"]) { $res = CIBlockSection::GetByID($r_item["IBLOCK_SECTION_ID"]); $ar_res = $res->GetNext(); } else { $ar_res = array("ID" => 0, "IBLOCK_SECTION_ID" => 0, "NAME" => "", "SORT" => -1, "DESCRIPTION" => ""); } if ($ar_res) { $top_sections[$r_item["IBLOCK_SECTION_ID"]] = array("ID" => $ar_res['ID'], "IBLOCK_SECTION_ID" => $ar_res['IBLOCK_SECTION_ID'], "NAME" => $is_virtual_section ? "" : $ar_res['NAME'], "SORT" => $ar_res['SORT'], "DESCRIPTION" => $ar_res['DESCRIPTION'], "SECTIONS" => array()); } else { $top_sections[$r_item["IBLOCK_SECTION_ID"]] = false; } } if ($top_sections[$r_item["IBLOCK_SECTION_ID"]] !== false) { $top_sections[$r_item["IBLOCK_SECTION_ID"]]["SECTIONS"][] = $r_item; } } $arResult["SECTIONS"] = $top_sections; DrclinicsHelper::sortItemsList($arResult["SECTIONS"]); foreach ($arResult["SECTIONS"] as &$subsection) { DrclinicsHelper::sortItemsList($subsection["SECTIONS"]); foreach ($subsection["SECTIONS"] as &$subsubsection) { DrclinicsHelper::sortItemsList($subsubsection["ITEMS"]); } unset($subsubsection); } unset($subsection);
$arItems[$k]["ACTIVE"] = $active_direction == $arItem["ID"]; if ($arItems[$k]["ACTIVE"]) { $currentItem = $arItems[$k]; if (isset($arParams["ADD_SECTION_CHAIN"]) && $arParams["ADD_SECTION_CHAIN"] == "Y") { $APPLICATION->AddChainItem("Услуги и цены", "/nashi-uslugi/med-uslugi/"); if ($currentItem['NAME']) { $APPLICATION->AddChainItem($currentItem['NAME'], $currentItem["SECTION_PAGE_URL"]); } } if (isset($arParams["SET_TITLE"]) && $arParams["SET_TITLE"] == "Y") { $currentItem['NAME'] = $currentItem['NAME'] ? $currentItem['NAME'] : 'Услуги и цены'; $APPLICATION->SetTitle($currentItem['NAME']); } } $k++; } $arResult = $currentItem; $arResult["FILTERS"] = DrclinicsHelper::getMediaspectFilters(isset($arResult["ID"]) ? $arResult["ID"] : false); if (isset($_SESSION["PICKED_SERVICES"]) && $_SESSION["PICKED_SERVICES"]) { $arResult['PICKED_SERVICES'] = DrclinicsHelper::getServices($_SESSION["PICKED_SERVICES"], false, true); } else { $arResult['PICKED_SERVICES'] = array(); } $arResult['ITEMS'] = $arItems; $arResult["TAB"] = isset($_REQUEST["active_tab"]) && $_REQUEST["active_tab"] ? $_REQUEST["active_tab"] : ""; $arResult["VIEW_ALL_LINK"] = isset($arParams['VIEW_ALL_LINK']) ? $arParams['VIEW_ALL_LINK'] : "Y"; $arResult['SERVICES_ITEMS_COUNT'] = isset($arParams['SERVICES_ITEMS_COUNT']) && $arParams['SERVICES_ITEMS_COUNT'] > 0 ? $arParams['SERVICES_ITEMS_COUNT'] : 0; $arResult['DOCTORS_ITEMS_COUNT'] = isset($arParams['DOCTORS_ITEMS_COUNT']) && $arParams['DOCTORS_ITEMS_COUNT'] > 0 ? $arParams['DOCTORS_ITEMS_COUNT'] : 0; $arResult['CLINICS_ITEMS_COUNT'] = isset($arParams['CLINICS_ITEMS_COUNT']) && $arParams['CLINICS_ITEMS_COUNT'] > 0 ? $arParams['CLINICS_ITEMS_COUNT'] : 0; $arResult['PROGRAMS_ITEMS_COUNT'] = isset($arParams['PROGRAMS_ITEMS_COUNT']) && $arParams['PROGRAMS_ITEMS_COUNT'] > 0 ? $arParams['PROGRAMS_ITEMS_COUNT'] : 0; $this->IncludeComponentTemplate();