Forum
Sorting a Collection by Multiple Fields
What is the syntax to sort a colleciton by multiple fields? I have found an example to filter by multiple field value, so though the syntax might be similar but I can't get that to work.
Here's what I have now
perch_collection('Tours',array(
'template' => 'tour_covers.html',
'filter' => [
[
'filter'=>'TourFilter',
'match'=>'contains',
'value'=> $FilterValue,
],
[
'filter' =>'Title',
'match' => 'neq',
'value' => '',
],
],
'sort' => "Title',
'sort-order' => 'ASC',
'count' => 99
));
I would like to sort the collection two fields - by Location and then Title.
Many thanks James
You can't currently sort my multiple fields. You can create a compound field and sort by that, however.