I need to filter the pager with a DESC order date, I've tried ways but still not work for me, any idea friends?
public function admin_index(){
$this->layout = "admin_default";
$conditions = array('status'=>1);
$filter = array();
if(!empty($this->request->query)){
$search = basicsLix::removeAcutes('%'.$this->request['url']['search'].'%');
$filter = $this->request->query;
$conditions += array('OR' => array(
basicsLix::removeSpecialCharacter('purchaser_name')=>$search),
'order'=>array( 'payment_date' => 'asc'));
}
$purchases = $this->paginate('Purchase', $conditions);
$this->set(compact('purchases', 'filter'));
}
Error:
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order = ('asc') LIMIT 20' at line 1
SQL Query: SELECT Purchase
.id
, Purchase
.track_id
, Purchase
.purchase_order
, Purchase
.purchaser_name
, Purchase
.purchaser_email
, Purchase
.amount
, Purchase
.status
, Purchase
.dispatched
, Purchase
.method
, Purchase
.payment_date
, Purchase
.hash
, Purchase
.created
, Purchase
.modified
FROM resultados_tagid
.purchases
AS Purchase
WHERE status
= 1 AND CONVERT( CAST( UPPER(TRIM(REPLACE(REPLACE(REPLACE(purchaser_name, ',',''), '.',''), '-',''))) AS BINARY) USING utf8) LIKE '%%' AND order = ('asc') LIMIT 20