E
E
Ex1st2021-11-19 12:33:50
1C-Bitrix
Ex1st, 2021-11-19 12:33:50

Custom sorting by dynamic values ​​in catalog.section?

The bottom line is that in order to render products, I pass a dynamically obtained list of product IDs to the catalog.section component.

Each time the list of product IDs is different, which means I can't store the values ​​for sorting in the database as properties. The sorting parameter (ELEMENT_SORT_FIELD) can only take values ​​from the database.

At first I decided to go head-on and at the end of the result.modifier catalog.section sorted arResult['ITEMS'] as needed, but soon I realized that each next pagination page starts sorting again.

For example:
If the first 20 products are sorted by the numbers 1,2,3, then the next page does not continue 4,5,6, but starts again - 1,2,3.

What can be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2021-11-19
@Ex1st

ELEMENT_SORT_FIELD supports sorting by list id

"ELEMENT_SORT_FIELD" => "ID",
"ELEMENT_SORT_ORDER" => $arElements // массив ID в нужном порядке

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question