- Posts: 129
- Thank you received: 0
Support for SermonSpeaker 5.x is in bugfix mode only, the same as it is for Joomla 3.10.
I will not add any new features to this releases.
Please upgrade to SermonSpeaker 6.x and Joomla 4.x, which is better anyway.
I will not add any new features to this releases.
Please upgrade to SermonSpeaker 6.x and Joomla 4.x, which is better anyway.
Sort order of sermons in a serie
29 Feb 2016 10:47 #5926
by Ken Lee
Sort order of sermons in a serie was created by Ken Lee
Dear Thomas,
I notice that in Global Configuration Default order sets the order for sermon lists and it applies to all sermon lists. If an end-user changes the the sort order at a particular serie (e.g. by clicking the Title column heading), all subsequent browsing to other series shall follow that order.
Can I hard-code a sort order for particular series? such as:
Series A: Sort Sermons by Descending Titles
Series B: Sort Sermons by Ascending Titles
Thanks a lot.
Ken
I notice that in Global Configuration Default order sets the order for sermon lists and it applies to all sermon lists. If an end-user changes the the sort order at a particular serie (e.g. by clicking the Title column heading), all subsequent browsing to other series shall follow that order.
Can I hard-code a sort order for particular series? such as:
Series A: Sort Sermons by Descending Titles
Series B: Sort Sermons by Ascending Titles
Thanks a lot.
Ken
Please Log in or Create an account to join the conversation.
- Thomas Hunziker
-
- Offline
- Administrator
-
29 Feb 2016 12:19 #5927
by Thomas Hunziker
Replied by Thomas Hunziker on topic Sort order of sermons in a serie
You could hardcode it by setting the ordering state based on the series ID.
Similar to what I do here: github.com/Bakual/SermonSpeaker/blob/mas...ermons.php#L300-L301
The question is more where you want to put that code. The only place you can adjust things without hacking files is the layout. But at this time, the items are already retrieved. So you either have to hack the files (setting the state between getting the state and getting the items) or you do the query to retrieve the items again in the layout. There is no nice solution to this.
Similar to what I do here: github.com/Bakual/SermonSpeaker/blob/mas...ermons.php#L300-L301
The question is more where you want to put that code. The only place you can adjust things without hacking files is the layout. But at this time, the items are already retrieved. So you either have to hack the files (setting the state between getting the state and getting the items) or you do the query to retrieve the items again in the layout. There is no nice solution to this.
The following user(s) said Thank You: Ken Lee
Please Log in or Create an account to join the conversation.
20 Apr 2016 09:50 #6095
by Ken Lee
Replied by Ken Lee on topic Sort order of sermons in a serie
Dear Thomas,
I hacked the model sermons.php's order function at the end of getListQuery() function.
Thank you for your advice.
Ken
I hacked the model sermons.php's order function at the end of getListQuery() function.
Thank you for your advice.
Ken
Please Log in or Create an account to join the conversation.
24 Apr 2016 13:56 #6097
by Khuzema
Replied by Khuzema on topic Sort order of sermons in a serie
Hey Ken, Would you like to describe how did you sorted the sermons by hacking the file?
Please Log in or Create an account to join the conversation.
25 Apr 2016 03:37 #6098
by Ken Lee
Replied by Ken Lee on topic Sort order of sermons in a serie
Dear Khuzema,
I did this:
Edit /components/com_sermonspeaker/models/sermons.php.
Near the end of function getListQuery() you see lines, they are building the sort order of the SQL statement.
$query->order($db->escape($this->getState('list.ordering', 'ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
I commented out $query->order(.... line and replace it with mine. I want my sermons sorted by publishing date.
$query->order('publish_up' . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
I am concerned with some sermons which have no publish dates, and they appear in almost arbitrary order, so I added one more line:
$query->order('title' . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
This make sermons sort by title, when publish_up field makes a draw.
Of course you will put sort order according to your own situation. And, also importantly, your changes will be overwritten if you later upgrade Sermon Speakers. One more disclaimer, I am just a programming amateur. Do this at your own risk.
I did this:
Edit /components/com_sermonspeaker/models/sermons.php.
Near the end of function getListQuery() you see lines, they are building the sort order of the SQL statement.
$query->order($db->escape($this->getState('list.ordering', 'ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
I commented out $query->order(.... line and replace it with mine. I want my sermons sorted by publishing date.
$query->order('publish_up' . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
I am concerned with some sermons which have no publish dates, and they appear in almost arbitrary order, so I added one more line:
$query->order('title' . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
This make sermons sort by title, when publish_up field makes a draw.
Of course you will put sort order according to your own situation. And, also importantly, your changes will be overwritten if you later upgrade Sermon Speakers. One more disclaimer, I am just a programming amateur. Do this at your own risk.
Please Log in or Create an account to join the conversation.
Time to create page: 0.148 seconds