Answer the question
In order to leave comments, you need to log in
Why doesn't the filter for selecting infoblock elements by ID work?
The task is to display the "Related Products" of the catalog - elements of the infoblock by ID. Related products - are bound through a property - as a result, I get an array of data with an ID - the necessary products.
$arResult["PROPERTIES"]["ASSOCIATED"]["VALUE"]
Array
(
[0] => 1400
[1] => 966
[2] => 997
[3] => 1002
[4] => 1009
[ 5] => 1013
[6] => 1017
[7] => 1019
[8] => 1012
[9] => 1000
)
To display selected items, I use the catalog.section component , with the settings:
"USE_FILTER" => "Y",
"
FILTER_NAME
"
=> "arrAssociated " "]["ASSOCIATED"]["VALUE"]) ;
Does not work, products are not displayed by the filter, but if you pass the ID data in the form -
$GLOBALS["arrAssociated"] = array('ID' => array(1400, 966, 997, 1002, 1009) )
Everything works out successfully.
How to bring the data from the array => $arResult["PROPERTIES"]["ASSOCIATED"]["VALUE"] to the correct form so that the filter works.
Answer the question
In order to leave comments, you need to log in
Problem solved - solutions are in the comments.
The essence of the problem is that the data contained in $arResult in the component.epilog.php file is not available. To pass the necessary parameters contained in $arResult, you need to pass them from the cached area of the component to component_epilog.php:
$cp = $this->__component;
if (is_object($cp))
{
$cp->arResult["ASSOCIATED"] = $arResult["PROPERTIES"]["ASSOCIATED"]["VALUE"];
$cp->SetResultCacheKeys(array("ASSOCIATED")); //cache keys in $arResult array
}
$templateData["ASSOCIATED"] = $arResult["PROPERTIES"]["ASSOCIATED"]["VALUE"];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question