Answer the question
In order to leave comments, you need to log in
How to make one more field a field for sorting in the catalog one for the filter another for sections?
I created a field in the admin panel in the section in additional fields, but how can I bind it to sorting?
how to add this field here I insert UF_SORT but it does not sort by it
Answer the question
In order to leave comments, you need to log in
Since the iblock module version 20.0.400, the CUSTOM_SECTION_SORT parameter has become available in the catalog.section.list component and it works - I checked it myself.
In versions of the module lower than specified in the documentation, this parameter will not work.
You can find it in the file /bitrix/components/bitrix/catalog.section.list/component.php
//ORDER BY
$arSort = array(
"left_margin"=>"asc",
);
//ORDER BY
$arSort = array();
if (!empty($this->arParams['CUSTOM_SECTION_SORT']) && is_array($this->arParams['CUSTOM_SECTION_SORT']))
{
foreach ($this->arParams['CUSTOM_SECTION_SORT'] as $field => $value)
{
if (!is_string($value))
{
continue;
}
$field = strtoupper($field);
if (isset($arSort[$field]))
{
continue;
}
if (!preg_match('/^(asc|desc|nulls)(,asc|,desc|,nulls)?$/i', $value))
{
continue;
}
$arSort[$field] = $value;
}
unset($field, $value);
}
if (empty($arSort))
{
$arSort = array(
"LEFT_MARGIN" => "ASC",
);
}
$sectionListParams = array(
//.......
"CUSTOM_SECTION_SORT" => array("UF_SORT" => "ASC")
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question