Jump to content

Custom module. Orderby option with two arguments


Recommended Posts

Hi, I think its not a big problem, but here we go.

 

I've created a module and added it to admin meniu. There I'm showing one table from database, but the problem is that I need that table to be with specific order.

 

There are two columns "reservation_date" and "reservation_time". The date should be with orderway "DESC" and time should be ordering by "ASC" way. But how to accomplish that? 

 

All I got now is this:

 

$this->_orderBy = 'a.reservation_date';

$this->_orderWay = 'DESC';

 

But I also need to order by time. PLEASE HELP ME!!

 

I think its not difficult, but I can't find an answer for a whole day!

Edited by haspo (see edit history)
Link to comment
Share on other sites

It's not possible using PrestaShop's helper classes. It seems you'll have to override the AdminController::getList function. I see the ORDER BY part on line 3213:

            $sql_order_by = ' ORDER BY '.((str_replace('`', '', $order_by) == $this->identifier) ? 'a.' : '').$order_by.' '.pSQL($order_way).
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...