A
A
aspisklov2017-02-27 18:55:06
1C-Bitrix
aspisklov, 2017-02-27 18:55:06

Bitrix:catalog.smart.filter sorting values ​​in property lists?

How to automatically sort the values ​​in the lists of properties alphabetically in the "Smart Filter" of Bitrix??? I know about manual sorting - but there are too many parameters, so it's not an option. The documentation was reviewed 100 times - there is no answer there.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
aspisklov, 2017-03-03
@aspisklov

Solved the problem with a crutch.
In the standard smart filter template file catalog.smart.filter/.default/template.php add the following code after line 156

<? //Сортировка по алфавиту
          foreach ($arItem["VALUES"] as $key => $sortkey) {
            $values[$key]  = $sortkey['VALUE'];
          }
          array_multisort($values, SORT_ASC, $arItem['VALUES']);
          unset($values);
          ?>

S
Sergey, 2017-02-27
@gangstarcj

Take an array and sort php.net/manual/en/array.sorting.php

K
KonstantinGreat, 2020-09-25
@KonstantinGreat

It depends on the type of property, I use element binding more often (and I advise everyone to do the same), in which case the property values ​​can be sorted by the sort field
(does not work with element binding with autocomplete, I think this is only in older versions of the kernel)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question