Reports Plugin: reversing order of results

I am trying to figure out how to display the results of a report in ascending order, as opposed to the default descending order, and after a few hours haven't got very far.

I would imagine that I need to modify the HTML report (Html.php) to do this, and somewhere in here:


<?php $page = 1;
while ($items = get_db()->getTable('Item')->findBy($this->_params, 30, $page)):
foreach ($items as $item) : ?>

I have tried adding this line below the above, but it didn't work:


<?php $items = array_reverse($items); ?>

Any tips gratefully received!

Tom

In that snippet of code, try adding these to $this->_params before calling findBy

'sort_field' => 'added'
'sort_dir'   => 'a'

or something similar, based on what field you need to sort on.

Thanks Patrick,

I used this code in the end which works well:

$params = array (
       'sort_field' => 'added',
       'sort_dir'   => 'a'
       );
         while ($items = get_db()->getTable('Item')->findBy($params, 30, $page)):