Answer the question
In order to leave comments, you need to log in
How to refine the sorting of numbers through the snippet in MODX REVO?
Such a question, why sorting works fine with pagetitle, but crookedly with the price?
Those. 12000 , 14000 , 4000 , 260000 , 2000 and vice versa?
Is this due to the fact that I messed up something with the date type or something else?
<div class="sort">
Сортировать:
</div>
<div id="Collection-content">
<?php
if($_GET['sort'] == $field and $_GET['dir'] == 'ASC') {$arr='↑';}
if($_GET['sort'] == $field and $_GET['dir'] == 'DESC') {$arr='↓';}
if(!$_GET[$field]){
if($_GET['dir'] == 'ASC'){
$output = '<a style="color:#000" href="'.$url.'?'.$q.'sort='.$field.'&dir=DESC#prod">'.$name.''.$arr.'</a>';
} else {
$output = '<a style="color:#000" href="'.$url.'?'.$q.'sort='.$field.'&dir=ASC#prod">'.$name.''.$arr.'</a>';
}
} else {
$output = '<a style="color:#000" href="'.$url.'?'.$q.'sort='.$field.'&dir=ASC#prod">'.$name.'</a>';
}
return $output;
<?php
$sort = $_GET['sort'];
if($sort == '') {
$output='&sortby=`{"menuindex":"ASC"}`';
} else {
$output = '&sortby=`{"'.$sort.'":"'.$_GET['dir'].'"}`';
}
return $output;
Answer the question
In order to leave comments, you need to log in
Understood there was an error in filling, text instead of numbers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question