Page 1 of 1

Add an article sort order menu to frontend template

Posted: Mon Jul 13, 2020 8:08 pm
by tristanbailey
Hi

Have a design where they want to let the users change the sort order, newest to oldest etc, 4 different options.
So these orders are normal sql but how to add a form select on the website that changes order, then the page reload.

---
[Date - Newest first | Date - Oldest first | A-Z | Z-A]

Article title A
date: Aug 2


Article title B
date: Aug 6

---

It does not need to be ajax, just change the order and reload.

Re: Add an article sort order menu to frontend template

Posted: Tue Jul 14, 2020 1:46 am
by ranwilli
I think you'll have to build your own...

Have a look at Fabrik

I love using it, and I know you can do as you need with it.

Re: Add an article sort order menu to frontend template

Posted: Tue Jul 14, 2020 6:59 pm
by tristanbailey
Seems I might need to build one, just was hoping to find a similar component.

You can do column sorting on a List articles layout, so see if I can base some on that.

Re: Add an article sort order menu to frontend template

Posted: Tue Jul 14, 2020 7:27 pm
by sozzled
One way—not necessarily the "neatest" workaround—is to have four menu items:

1) Newest to oldest
2) Oldest to newest
3) Alphabetical A-Z
4) Alphabetical Z-A

Have the first menu item as the "default" in your main site menu (with the other three items hidden).

Create a module to appear on your 'blog pages—I assume that's the kind of layout you're interested in—with links to all four menu items and display the module on these pages in such a way as people will find it.

I might try this idea out myself on a test site. ;)

As you say, the list layout style has the ability to do this, if you're only interested in displaying a list of articles.

Re: Add an article sort order menu to frontend template

Posted: Tue Jul 14, 2020 7:46 pm
by Per Yngve Berg
Use a split menu as the second menu module.

https://docs.joomla.org/Split_menus

Re: Add an article sort order menu to frontend template

Posted: Tue Jul 14, 2020 8:03 pm
by ranwilli
Come on, you guys! My solution was waaaaaay harder and more complicated than those you’ve proposed.

Re: Add an article sort order menu to frontend template

Posted: Tue Jul 14, 2020 8:52 pm
by sozzled
:laugh: @ranwilli

@tristanbailey: here's the simplest solution:

Create four menu items like I've shown in the following screenshot:
blogMenus.png
See it in operation here: https://j3xdemo.enduring.com.au/

Took me 5 minutes to put it together. ;)

Re: Add an article sort order menu to frontend template

Posted: Wed Jul 15, 2020 2:58 am
by AlexVega
sozzled wrote:
Tue Jul 14, 2020 7:27 pm
One way—not necessarily the "neatest" workaround—is to have four menu items:

1) Newest to oldest
2) Oldest to newest
3) Alphabetical A-Z
4) Alphabetical Z-A

Have the first menu item as the "default" in your main site menu (with the other three items hidden).

Create a module to appear on your 'blog pages—I assume that's the kind of layout you're interested in—with links to all four menu items and display the module on these pages in such a way as people will find it.

I might try this idea out myself on a test site. ;)

As you say, the list layout style has the ability to do this, if you're only interested in displaying a list of articles.

+ 1

Very creative, simple and ready from the core solution @sozzled.