-
AuthorPosts
-
erickpaulino Friend
erickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
July 22, 2014 at 10:38 pm #199896Hello,
I am trying to add a new sorting option to the Latest News Module so I can use it with the JA Magz “focus” alternative layout. I want to be able to sort Featured Articles in the order I set on the Admin panel, DESCENDING.
I am trying to edit the file modules/mod_articles_latest/helper.php which originally is:
// Set ordering
$order_map = array(
'm_dsc' => 'a.modified DESC, a.created',
'mc_dsc' => 'CASE WHEN (a.modified = ' . $db->quote($db->getNullDate()) . ') THEN a.created ELSE a.modified END',
'c_dsc' => 'a.created',
'p_dsc' => 'a.publish_up',
'random' => 'RAND()',
I have added a last line:
// Set ordering
$order_map = array(
'm_dsc' => 'a.modified DESC, a.created',
'mc_dsc' => 'CASE WHEN (a.modified = ' . $db->quote($db->getNullDate()) . ') THEN a.created ELSE a.modified END',
'c_dsc' => 'a.created',
'p_dsc' => 'a.publish_up',
'random' => 'RAND()',
'sort_order' => 'a.ordering',and added the respective option to the XML file. The problem is that “a.ordering” is not sorting the articles the way I want.
Can you help me what should I use instead of “a.ordering” to sort the Featured Articles in the order I set on the Admin panel, DESCENDING?
Thank you,
Erick
Adam M ModeratorAdam M
- Join date:
- May 2014
- Posts:
- 5159
- Downloads:
- 33
- Uploads:
- 66
- Thanks:
- 95
- Thanked:
- 1271 times in 1235 posts
July 24, 2014 at 10:34 am #543351Hi Erick,
Could you please clarify a little bit so I can assist you better ? Provide a screenshot would help a lots.
erickpaulino Frienderickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
July 25, 2014 at 6:09 pm #543475Hello,
Sure, let me try to put it simpler. This is the Latest News Module, as you can see on JA Magz documentation:
I has a pretty cool layout, which is called “JA Magz – Focus”:
What I want to do is to sort the articles shown in this module not by date, but by “Featured articles order”. Unfortunately, this option is not available for the Latest News module:
At first, I tried to do that by replacing the “Latest News module” by the “Articles Category Module”, which already have the sorting option I want. But I cannot use the “Focus” Alternative Layout with it.
So, I believe there are two possible solutions for this:
1. Add the filtering option I want to the Latest News module, as I have asked in my first message;
2. Add the Focus Layout to the Articles Categories module. Maybe this is simpler, but by default this option is not available in the module manager.Hope this is better explained now…
Thank you!
Erick
- Adam M Moderator
Adam M
- Join date:
- May 2014
- Posts:
- 5159
- Downloads:
- 33
- Uploads:
- 66
- Thanks:
- 95
- Thanked:
- 1271 times in 1235 posts
July 28, 2014 at 10:45 am #543612Hi,
You might want to try this :
1. Open file root_folder/modules/mod_articles_latest/mod_articles_latest.xml and look for this code :
<field
name="ordering"
type="list"
default="published"
label="MOD_LATEST_NEWS_FIELD_ORDERING_LABEL"
description="MOD_LATEST_NEWS_FIELD_ORDERING_DESC">
<option
value="c_dsc">MOD_LATEST_NEWS_VALUE_RECENT_ADDED</option>
<option
value="m_dsc">MOD_LATEST_NEWS_VALUE_RECENT_MODIFIED</option>
<option
value="p_dsc">MOD_LATEST_NEWS_VALUE_RECENT_PUBLISHED</option>
<option
value="mc_dsc">MOD_LATEST_NEWS_VALUE_RECENT_TOUCHED</option>
<option
value="random">MOD_LATEST_NEWS_VALUE_RECENT_RAND</option>
</field>then update as below :
<field
name="ordering"
type="list"
default="published"
label="MOD_LATEST_NEWS_FIELD_ORDERING_LABEL"
description="MOD_LATEST_NEWS_FIELD_ORDERING_DESC">
<option
value="fp_dsc">MOD_LATEST_NEWS_VALUE_ORDERINGFEATURED</option>
<option
value="c_dsc">MOD_LATEST_NEWS_VALUE_RECENT_ADDED</option>
<option
value="m_dsc">MOD_LATEST_NEWS_VALUE_RECENT_MODIFIED</option>
<option
value="p_dsc">MOD_LATEST_NEWS_VALUE_RECENT_PUBLISHED</option>
<option
value="mc_dsc">MOD_LATEST_NEWS_VALUE_RECENT_TOUCHED</option>
<option
value="random">MOD_LATEST_NEWS_VALUE_RECENT_RAND</option>
</field>2. Then open file root_folder/modules/mod_articles_latest/helper.php and look for this code :
// Set ordering
$order_map = array(
'm_dsc' => 'a.modified DESC, a.created',
'mc_dsc' => 'CASE WHEN (a.modified = ' . $db->quote($db->getNullDate()) . ') THEN a.created ELSE a.modified END',
'c_dsc' => 'a.created',
'p_dsc' => 'a.publish_up',
'random' => 'RAND()',
);and update as below :
// Set ordering
$order_map = array(
'm_dsc' => 'a.modified DESC, a.created',
'mc_dsc' => 'CASE WHEN (a.modified = ' . $db->quote($db->getNullDate()) . ') THEN a.created ELSE a.modified END',
'c_dsc' => 'a.created',
'fp_dsc' => 'fp.ordering',
'p_dsc' => 'a.publish_up',
'random' => 'RAND()',
);erickpaulino Frienderickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
July 30, 2014 at 2:22 pm #543930Thank you, I’ll try it soon and I’ll let you know.
erickpaulino Frienderickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
July 31, 2014 at 9:55 pm #544075Hello,
It didn’t work. I also tried
'fp_dsc' => 'a.featured DESC, fp.ordering',
as suggested here:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28171but it didn’t work either. It did change the order, but in a strange and unpredictable manner.
Any other suggestion?
Thank you,
Erick
Adam M ModeratorAdam M
- Join date:
- May 2014
- Posts:
- 5159
- Downloads:
- 33
- Uploads:
- 66
- Thanks:
- 95
- Thanked:
- 1271 times in 1235 posts
August 1, 2014 at 4:31 am #544108Hi Erick,
Please make sure that you will have to navigate to Admin >>> Extensions >>> Module Manager >>> choose Latest News module >>> in Order option >>> choose new filter then Save.
erickpaulino Frienderickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
August 1, 2014 at 10:55 am #544158Hello,
Yes, I’m doing this. I’m also setting the filter to display only featured articles. I believe it’s a matter of finding the right code to replace the ‘fp_dsc’ => ‘fp.ordering’
Any suggestions?
Thank you
Adam M ModeratorAdam M
- Join date:
- May 2014
- Posts:
- 5159
- Downloads:
- 33
- Uploads:
- 66
- Thanks:
- 95
- Thanked:
- 1271 times in 1235 posts
August 4, 2014 at 10:40 am #544425Hi,
Please hold on a little bit while I’m checking this matter for you.
Adam M ModeratorAdam M
- Join date:
- May 2014
- Posts:
- 5159
- Downloads:
- 33
- Uploads:
- 66
- Thanks:
- 95
- Thanked:
- 1271 times in 1235 posts
August 6, 2014 at 4:05 am #544735Hi,
Could you please provide your site url and temporary back-end account via private reply so I can take a closer look ?
erickpaulino Frienderickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
August 20, 2014 at 1:18 am #546594Hello Adam M,
I have just sent you a message.
Thank you,
Erick
erickpaulino Frienderickpaulino
- Join date:
- May 2013
- Posts:
- 78
- Downloads:
- 12
- Uploads:
- 25
- Thanks:
- 19
- Thanked:
- 3 times in 1 posts
August 20, 2014 at 2:41 am #546604Hello Adam M,
Me again. I have just found the solution. Under templates/ja_magz/html/mod_articles_latest/focus.php
there is a code to force articles to be ordered by hits. I have commented out the lines below
//sort those latest article by hits
//$compare = create_function('$a, $b', ' if ($a->hits == $b->hits) { return 0; } return ($a->hits < $b->hits) ? 1 : -1; ');
//uasort($list, $compare);
And it is now working.
Thank you!
1 user says Thank You to erickpaulino for this useful post
Adam M ModeratorAdam M
- Join date:
- May 2014
- Posts:
- 5159
- Downloads:
- 33
- Uploads:
- 66
- Thanks:
- 95
- Thanked:
- 1271 times in 1235 posts
August 20, 2014 at 9:59 am #546691Hi,
Glad to hear that you managed to sort it out. If you still have any question, don’t hesitate to let me know.
1 user says Thank You to Adam M for this useful post
AuthorPostsViewing 13 posts - 1 through 13 (of 13 total)This topic contains 13 replies, has 2 voices, and was last updated by Adam M 10 years, 3 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum