S
S
Sergey2021-03-25 17:31:59
1C-Bitrix
Sergey, 2021-03-25 17:31:59

How to parse the Bitrix filter parameters?

Good afternoon.

It is necessary to set up analytics on the Bitrix filter (you can’t do it by urls - there is logic).
Tell me how you can get the selected data in the Bitrix filter, maybe there is an array with the selected parameters or something else?

I don't want to cheat and parse the url as a string, thanks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2021-03-25
@winer

The arResult of the catalog.smart.filter template has everything. If data is needed outside the template, then in result_modifier form an array with the necessary data, add it to arResult. Pass the key of the added array to SetResultCacheKeys, and in component_epilog make a global variable with this data.
result_modifier.php

$customFields = [];//Ваши данные
/** @var CBitrixComponent $component */
$component = $this->__component;

$component->setResultCacheKeys(["CUSTOM_FIELDS"]);

component_epilog.php
global $customFields ;

$customFields = $arResult["CUSTOM_FIELDS"];

After that, the array with the data you need will be available outside the component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question