If anyone is interested, then I found a way around this bitrix slip. But at once I will make a reservation that he also has a serious disadvantage - if you use pagination on the site, then with this method filtering and sorting will only work on the page you are on.
Save us result_modifier and PHP function - usort. First, create a class in init.php:
class CCabinet_SortObject { function __cmp_ValueOf($a, $b, $name, $order) { if(is_set($a[$name]) && is_set($b[$name])) { if($order == 'ASC') return ($a[$name]<$b[$name])?true:false; elseif($order == 'DESC')return ($b[$name]>$a[$name])?false:true; } } function cmp_袙袗楔_袩袗袪袦袝孝袪_袙袗楔_袩袨袪携袛袨袣($a, $b) { return CCabinet_SortObject::__cmp_ValueOf($a, $b, "袩袗袪袗袦袝孝袪_小袨袪孝袠袪袨袙袣袠", "袩袨袪携袛袨袣_小袨袪孝袠袪袨袙袣袠"); } function cmp_袙袗楔_袩袗袪袦袝孝袪_袙袗楔_袩袨袪携袛袨袣($a, $b) { return CCabinet_SortObject::__cmp_ValueOf($a, $b, "袩袗袪袗袦袝孝袪_小袨袪孝袠袪袨袙袣袠", "袩袨袪携袛袨袣_小袨袪孝袠袪袨袙袣袠"); }
It will allow us to sort the finished array after the search. We will call it in result_modifier in this way:
if(isset($_GET["by"]) && isset($_GET["order"])) { usort($arResult['袦袗小小袠袙'],array("CCabinet_SortObject","cmp_".$_GET["by"]."_".$_GET["order"])); }
That is, we specify our array, which must be sorted, and then by - by what field to sort, order - the sort order. Actually that's all. Filtering, I think, it makes no special sense to paint - everything is simple there. It is only necessary to catch our parameter and filter on it.