I tried this but does not work. Syntax error
In models/agents.php
| Code: |
function _buildQuery()
{
if(JRequest::getVar('ShowOrderBy')){
$ShowOrderByDefault = JRequest::getVar('ShowOrderBy');}
switch ($ShowOrderByDefault)
{
case 1: $o='u.name';
break;
case 2: $o='u.company_location';
break;
default: $o='cantidad';
break;
}
$this->sqlShowOrderBy = ' ORDER BY '.$o;
if(JRequest::getVar('order')){ $this->sqlOrder=JRequest::getVar('order');}else{$this->sqlOrder='asc';}
$this->_query = 'SELECT * FROM #__properties_profiles AS u, COUNT(p.id) AS cantidad '
.' LEFT JOIN #__properties_products AS p ON (u.mid = p.agent_id) '
.' WHERE u.show = 1 '
.' GROUP BY u.mid '
. $this->sqlShowOrderBy .' '.$this->sqlOrder
;
return $this->_query;
}
|