Views: 1474 (Data available since 06.02.2017)
If simple components are used to publish an information block, elements can be sorted without using the Filter component and without customizing the component used to display the list of elements. Such sorting is based on the use of the parameter Name of the array with values used to filter elements and is available in the following components: bitrix:catalog.section, bitrix:catalog.sections.top and bitrix:news.list.
Filter array can be defined directly on the page before connecting a list component. However, in this case, you will have to create several pages placing a component and determining the filter array on each page. There is a simpler way: variables of the filter array may be submitted in a link.
In our example, variables for the filter will be submitted in a link using the GETmethod, and the filter $arrFilter will be determined from the array $_GET. Infoblock element publishing will be performed using the list component Section elements Section elements (bitrix:catalog.section).
Let us assume that we have the Products infoblock, and we will sort its elements using the property Manufacturer (MANUFACTURER):
Let us create a start page with a set of links (in our case, it will be a list of manufacturer countries):
The page code will be as follows::
<p>Filter by manufacturer:</p>
Now let us create the page filter.php and place the component (bitrix:catalog.section) there. Then, we should set a necessary infoblock in the component settings and fill in the field Name of the array with values used to filter elements with the value arrFilter.
Before connecting the component, let us add the following code:
$manufacturer = $_GET["MANUFACTURER"];
As a result, when passing from the home page (e.g., following the link Italy), the list of goods of the section with identifier 2 manufactured in Italy will open: