protected function getFilter() { $arFilter = array("IBLOCK_ID" => $this->getIblockId(), 'SECTION_ID' => $this->getSectionId() > 0 ? $this->getSectionId() : 0, 'ACTIVE' => empty($_REQUEST['filter_active']) ? 'Y' : $_REQUEST['filter_active'], "WF_PARENT_ELEMENT_ID" => false, "SHOW_NEW" => "Y"); if ($arProps = $this->getProps()) { $filtered = null; foreach ($arProps as $arProp) { $value = $_REQUEST['filter_el_property_' . $arProp["ID"]]; if (array_key_exists("AddFilterFields", $arProp["PROPERTY_USER_TYPE"])) { call_user_func_array($arProp["PROPERTY_USER_TYPE"]["AddFilterFields"], array($arProp, array("VALUE" => "filter_el_property_" . $arProp["ID"]), &$arFilter, &$filtered)); } elseif (is_array($value) || strlen($value)) { if ($value === "NOT_REF") { $value = false; } $arFilter["?PROPERTY_" . $arProp["ID"]] = $value; } } } $arSubQuery = array(); if ($arSKUProps = $this->getSkuProps()) { $arCatalog = $this->getOffersCatalog(); $arSubQuery = array("IBLOCK_ID" => $arCatalog['IBLOCK_ID']); $filtered = null; for ($i = 0, $intPropCount = count($arSKUProps); $i < $intPropCount; $i++) { if ('Y' == $arSKUProps[$i]["FILTRABLE"] && 'F' != $arSKUProps[$i]["PROPERTY_TYPE"] && $arCatalog['SKU_PROPERTY_ID'] != $arSKUProps[$i]["ID"]) { if (array_key_exists("AddFilterFields", $arSKUProps[$i]["PROPERTY_USER_TYPE"])) { call_user_func_array($arSKUProps[$i]["PROPERTY_USER_TYPE"]["AddFilterFields"], array($arSKUProps[$i], array("VALUE" => "filter_sub_el_property_" . $arSKUProps[$i]["ID"]), &$arSubQuery, &$filtered)); } else { $value = $_REQUEST['filter_sub_el_property_' . $arSKUProps[$i]["ID"]]; if (is_array($value) || strlen($value)) { if ($value === "NOT_REF") { $value = false; } $arSubQuery["?PROPERTY_" . $arSKUProps[$i]["ID"]] = $value; } } } } } if (!empty($_REQUEST["filter_timestamp_from"])) { $arFilter["DATE_MODIFY_FROM"] = $_REQUEST["filter_timestamp_from"]; } if (!empty($_REQUEST["filter_timestamp_to"])) { $arFilter["DATE_MODIFY_TO"] = $_REQUEST["filter_timestamp_to"]; } if (!empty($_REQUEST["filter_code"])) { $arFilter["CODE"] = $_REQUEST["filter_code"]; } $arSearchedIds = $arSearchedSectionIds = null; if (!empty($_REQUEST['QUERY'])) { $arFilter['QUERY'] = $_REQUEST['QUERY']; $arSearchedIds = $arSearchedSectionIds = array(0); if (preg_match('#^[0-9\\s]+$#', $_REQUEST['QUERY'])) { $barcode = preg_replace('#[^0-9]#', '', $_REQUEST['QUERY']); if (strlen($barcode) > 0) { $rsBarCode = \CCatalogStoreBarCode::getList(array(), array("BARCODE" => $barcode), false, false, array('PRODUCT_ID')); while ($res = $rsBarCode->Fetch()) { $res2 = \CCatalogSKU::GetProductInfo($res["PRODUCT_ID"]); $arSearchedIds[] = $res2 ? $res2['ID'] : $res['PRODUCT_ID']; } } } elseif ($this->isAdvancedSearchAvailable()) { $arFilter['PARAM2'] = $this->getIblockId(); if (!empty($arFilter['SECTION_ID'])) { $arFilter['PARAMS'] = array('iblock_section' => $arFilter['SECTION_ID']); } $obSearch = new \CSearch(); $obSearch->Search($arFilter); $cnt = 0; $activeSectionId = $this->getSectionId(); while ($ar = $obSearch->Fetch()) { if (strpos($ar['ITEM_ID'], 'S') === 0) { $sectionId = preg_replace('#[^0-9]+#', '', $ar['ITEM_ID']); if ($sectionId != $activeSectionId) { $arSearchedSectionIds[] = $sectionId; } } else { $arSearchedIds[] = $ar['ITEM_ID']; } if (++$cnt >= 100) { break; } } } else { $arSearchedIds = $arSearchedSectionIds = null; $arFilter['NAME'] = $_REQUEST['QUERY']; } } if (sizeof($arSubQuery) > 1) { $arFilteredIds = array(0); $db = \CIBlockElement::GetList(array(), $arSubQuery, false, false, array('PROPERTY_' . $arCatalog['SKU_PROPERTY_ID'])); while ($res = $db->Fetch()) { $arFilteredIds[] = $res['PROPERTY_' . $arCatalog['SKU_PROPERTY_ID'] . '_VALUE']; } $arFilter['ID'] = is_array($arSearchedIds) ? array_intersect($arFilteredIds, $arSearchedIds) : $arFilteredIds; } elseif ($arSearchedIds) { $arFilter['ID'] = $arSearchedIds; } if ($arSearchedSectionIds) { $arFilter['S_ID'] = $arSearchedSectionIds; } unset($arFilter['PARAM1'], $arFilter['PARAM2'], $arFilter['PARAMS']); if ($this->isFiltering() || !empty($_REQUEST['QUERY'])) { $arFilter['INCLUDE_SUBSECTIONS'] = 'Y'; if (isset($arFilter['SECTION_ID']) && $arFilter['SECTION_ID'] == 0) { unset($arFilter["SECTION_ID"]); } } return $arFilter; }
<tr> <td align="center" valign="top"><font class="text">( )</font></td> <td valign="top"><font class="text"> </font></td> <td><font class="text"><i>Круглые скобки</i> задают порядок действия логических операторов. </font></td> </tr> </table> </font> <?php } else { $obSearch->NavStart(20, false); $obSearch->NavPrint("Результаты поиска"); ?> <br><br> <?php $bEmptyFlag = True; while ($arResult = $obSearch->Fetch()) { $bEmptyFlag = False; ?> <font class="text"> <a href="<?php echo $arResult["URL"]; ?> "><?php echo $arResult["TITLE_FORMATED"]; ?> </a><br> <?php echo $arResult["BODY_FORMATED"]; ?> <hr size="1"> </font>
} if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite() && $arResult["filter_extranet"] == "Y") { $arUserGroupFilter["GROUP_SITE_ID"] = CExtranet::GetExtranetSiteID(); $arUserGroupFilter["<=ROLE"] = SONET_ROLES_USER; } if (!$arResult["CurrentUserPerms"]["IsCurrentUser"] && !CSocNetUser::IsCurrentUserModuleAdmin()) { $arGroupFilter["VISIBLE"] = "Y"; } } if ($arParams["USE_KEYWORDS"] == "Y" && strlen($arResult["~tags"]) > 0 && CModule::IncludeModule("search")) { $arFilter = array("SITE_ID" => SITE_ID, "QUERY" => "", array("=MODULE_ID" => "socialnetwork", "ITEM_ID" => "G%"), "CHECK_DATES" => "Y", "TAGS" => $arResult["~tags"]); $aSort = array("DATE_CHANGE" => "DESC", "CUSTOM_RANK" => "DESC", "RANK" => "DESC"); $obSearch = new CSearch(); $obSearch->Search($arFilter); if ($obSearch->errorno == 0) { while ($arSearch = $obSearch->Fetch()) { if (intval($arSearch["PARAM2"]) > 0) { $arGroupFilter["ID"][] = $arSearch["PARAM2"]; } } } } if (array_key_exists("ID", $arGroupFilter) && is_array($arGroupFilter["ID"])) { $arGroupFilter["ID"] = array_unique($arGroupFilter["ID"]); } if (!$bNoMyGroups) { if ($arUserGroupFilter && !empty($arUserGroupFilter)) { $dbUserGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arUserGroupFilter, false, false, array("GROUP_ID")); if ($dbUserGroups) { while ($arUserGroups = $dbUserGroups->GetNext()) { $arGroupFilter["ID"][] = $arUserGroups["GROUP_ID"];