I
I
Ilya2016-03-09 15:59:09
1C-Bitrix
Ilya, 2016-03-09 15:59:09

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

3 answer(s)
S
Sergey, 2016-03-09
@gangstarcj

"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.

R
Rad1calDreamer, 2016-03-10
@Rad1calDreamer

write your own component, at least complex, at least simple. With their templates and blackjack. What's the problem then?

A
Alexey, 2016-03-14
@rixaman

$GLOBALS["arrFilter"]
But the "bitrix:catalog" component has the "FILTER_NAME" => "arrFilter" parameter, it needs to specify the corresponding value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question