Answer the question
In order to leave comments, you need to log in
How to connect components to each other?
Hello!
The question is as follows: a catalog component is created with a filter:
- filter - forms a selection condition for the list of components
- catalog - accordingly displays the filtered list
Local question: how to transfer data from the filter to the catalog?
Global question: how to communicate between components?
---
Global variables are not suitable. it is impossible to tell in advance which component will connect first.
It comes to mind to use the API (modules), but somehow I'm confused by the remoteness of the component and its API. All the same, in modules, ideally, there should be only business logic.
You don’t have to start talking about standard components, because you shouldn’t use a footcloth that an inadequate maniac wrote.
Answer the question
In order to leave comments, you need to log in
"You don't have to start talking about standard components" - why don't you like a working solution? Why then take Bitrix at all, take a framework and do it on it.
According to the standard:
The filter must (mandatory) be connected before the catalog, so "because it is impossible to say in advance which component will connect first." not true.
They communicate through the global variable $GLOBALS["arrFilter"].
The best example is to look at the standard complex catalog component, everything seems to be clear in it. If you don't like it, you can at least take it as a basis and rewrite it however you want.
write your own component, at least complex, at least simple. With their templates and blackjack. What's the problem then?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question