G
G
Grione2020-05-14 15:39:29
1C-Bitrix
Grione, 2020-05-14 15:39:29

How to use different sorting of items depending on categories?

It is required, if the category has subcategories, then use sorting by views, and if this is the final category, then use the sorting set in the visual editor settings.

Sorting, as I understand it, is passed to the bitrix:catalog.section component.

In template.php in catalog.section I find out if there is a nesting like this

if(($arResult["RIGHT_MARGIN"] - $arResult["LEFT_MARGIN"]) == 1)

Then I try to change the sort variable like this

$arParams['ELEMENT_SORT_FIELD'] = 'id'

But it doesn't work.

As I understand it, I need to forward this variable to the component? But how to do that? Or am I doing it all wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2020-05-14
@Grione

Approximately in the right direction you think about margins, but you need to know this before calling the component, as if the code execution sequence is consistent)) component parameters->component->component template (including the template.php file)
Is the catalog component complex?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question