I
I
Ivan Trofimov2017-03-13 01:39:20
PHP
Ivan Trofimov, 2017-03-13 01:39:20

Bitrix: Selecting a section for a standard search page, how to implement it?

Bitrix has a "Standard search page" component. I want to customize it so that it is possible to select a search by sections.
Example: There are sections: smartphones, tablets, computers.
If you do not select a section during the search, then you should search everywhere. And if you select the smartphones section, it should search for products only from the smartphones section, and should not display products from other sections.
It looks like this:
Photo 1: ff3e311d73644c6aa82597920159fa88.jpg
Photo 2: fa1aee64d9a44dea86890fcc0b4d7e2b.jpg
I tried to do this:

<?
global $searchFilter;
$searchFilter = Array("section_id"=>"5");
?>

<?$APPLICATION->IncludeComponent("bitrix:search.page", ".default", array(
    "USE_FILTER" => "Y",
    "FILTER_NAME" => "searchFilter",
));?>

"section_id"=>"5"- this is the id of the "Smartphones" section, for example.
But does not react.
What else can you do to search for selected topics?
What can be added to result_modifier for the above task?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question