нужно сделать сортировку внутри группы по дате новые сверху, сейчас наоборот. Коды за это отвечающие - ниже. Но у меня не получается, на изменение $query->order('date ASC'); не реагирует, подскажите правильно как прописать.
public static function getSessionMatches($session_id, $tournament_id, $limit = NULL) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with "custom.".
$query->select($db->quoteName(array('date','spsoccer_match_id', 'title', 'slug', 'teamone', 'teamtwo', 'time', 'spsoccer_vanue_id', 'list_match_timeline',)));
$query->from($db->quoteName('#__spsoccer_matches'));
$query->where($db->quoteName('enabled')." = 1");
if (isset($session_id)) {
$query->where($db->quoteName('spsoccer_session_id')." = ".$db->quote($session_id));
}
$query->where($db->quoteName('spsoccer_tournament_id')." = ".$db->quote($tournament_id));
//$query->where($db->quoteName('access')." IN (" . implode( ',', JFactory::getUser()->getAuthorisedViewLevels() ). ")");
//Language
$query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()). ',' . $db->quote('*'). ')');
//Access
$query->where($db->quoteName('access')." IN (" . implode( ',', JFactory::getUser()->getAuthorisedViewLevels() ). ")");
$query->order('date ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();
return $results;
}
это сам вывод:
$this->sessions = $model->getTournamentSessions($this->item->spsoccer_tournament_id, 'ASC');
// Get Matches By Session and Tournament
foreach ($this->sessions as &$this->session) {
$this->session->session_matches = $model->getSessionMatches($this->session->spsoccer_session_id, $this->item->spsoccer_tournament_id, $fixture_order_by, $fixture_limit);
$this->session->title = (strpos($this->group->slug, 'uncategory') !== FALSE) ? JText::_('COM_SPSOOCER_SESSION') : $this->session->title;
foreach ($this->session->session_matches as &$this->session->session_match) {
//Get team one info
$this->session->session_match->team_one_info = $model->getTeamInfoById($this->session->session_match->teamone);
$this->session->session_match->team_one_url = JRoute::_('index.php?option=com_spsoccer&view=gameteam&id=' . $this->session->session_match->team_one_info->spsoccer_gameteam_id . ':' . $this->session->session_match->team_one_info->slug . SpsoccerHelper::getItemid('gameteams') . $tournament_url);
//Get team two info
$this->session->session_match->team_two_info = $model->getTeamInfoById($this->session->session_match->teamtwo);
$this->session->session_match->team_two_url = JRoute::_('index.php?option=com_spsoccer&view=gameteam&id=' . $this->session->session_match->team_two_info->spsoccer_gameteam_id . ':' . $this->session->session_match->team_two_info->slug . SpsoccerHelper::getItemid('gameteams') . $tournament_url);
//Match Date
$this->session->session_match->match_date = JHtml::date($this->session->session_match->date, 'd M, Y');
//Match Month
$this->session->session_match->match_time = date('H:i', strtotime($this->session->session_match->time));
//Match Location
$this->session->session_match->match_location = $model->getVanueInfoById($this->session->session_match->spsoccer_vanue_id);
$this->session->session_match->location_url = JRoute::_('index.php?option=com_spsoccer&view=vanue&id=' . $this->session->session_match->match_location->spsoccer_vanue_id . ':' . $this->session->session_match->match_location->slug . SpsoccerHelper::getItemid('vanues'));
} //END:: $this->session->session_matches
вот тут даты должны сортироваться в другом порядке: