Adding to sort order

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 8, 2016   (RSS)

By tCote - June 8, 2016

On my listing page I have the default sort order to sort from date. In my listings I have a field named stock_number. How would I add this field to the present sort code so that it sorts by date first and then stock number? 

Thanks

list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'perPage' => '10',
'orderBy' => 'createdDate DESC'

By Damon - June 8, 2016

Try this:

list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'perPage' => '10',
'orderBy' => 'createdDate DESC, stock_number DESC'

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/