jDownloads Support Forum

jDownloads for Joomla 4.x and 5.x => jDownloads 4.0 => General => Topic started by: WildLynxPilot on 25.10.2023 09:59:59

Title: Module in alphabetical order?
Post by: WildLynxPilot on 25.10.2023 09:59:59
Is there any module that can list the available downloads in alphabetical order?
Title: Re: Module in alphabetical order?
Post by: ColinM on 25.10.2023 10:23:26
Hi
You can list them in alphabetical order in the main views by using the sort bar but there is no Module that lists them alphabetically.
Could you perhaps explain why you would want such  a view in a module - these are typically located in a sidebar.
Thanks
Colin
Title: Re: Module in alphabetical order?
Post by: WildLynxPilot on 25.10.2023 11:06:26
Take a look at my site https://fsaddons.fi  - I have two modules in the right column, one with the newest additions or updates in chronological, descending order and one with a list of all the downloadable items. That long list in alphabetical, ascending order would make things much easier for a visitor, as you usually look for airports by the airport code (which I have as the first four letters on all items).

I will try to make an override for the jDownloads Latest module - already found the two lines that need to be changed so it should be easy...
Title: Re: Module in alphabetical order?
Post by: WildLynxPilot on 25.10.2023 11:28:05
So it seems that you can not override the helper file in Joomla... :-\  I had to change those two lines in the module itself to accomplish the alphabetical order. Works fine now. Will have to remember to do it after each update until that feature hopefully is included...
Title: Re: Module in alphabetical order?
Post by: Arno on 25.10.2023 13:00:47
I could add a sort option in the module. But then it wouldn't really be a 'Latest' module anymore.  ::)
Title: Re: Module in alphabetical order?
Post by: ColinM on 25.10.2023 17:04:11
Hi
@WildLynxPilot
Could you advise which 2 lines in the Latest Module you had to change.

@Arno
Do not think it would not be a problem to have dual purpose module like the Most Rated Module
Colin
Title: Re: Module in alphabetical order?
Post by: WildLynxPilot on 25.10.2023 18:41:17
In /modules/mod_jdownloads_latest/src/Helper/JDownloadsLatestHelper.php you will find a comment //Set sort ordering. The two lines below that comment!  I changed them from

// Set sort ordering
$ordering = 'a.created';
$dir = 'DESC';


to

// Set sort ordering
$ordering = 'a.title';
$dir = 'ASC';


and that made the trick. The first line for selecting the field (created, published, title etc.) and the second for sort order DESC for descending, ASC for ascending.