Sort order when viewing the landing page for a collection

So, my proof–of-concept site has 2 collections. I’ve update ItemsController.php to sort by Title, which works as expected when browsing items in a collection.

But, when I first go to what I think of as the landing page for the collection (url/collections/show/collection#), where it shows the collection-level metadata and displays the first 25 items in the collection with the option to browse the full collection, that screen displays items in descending order by date added. If it’s possible, where do I find the code for changing that display sort order?

Your quest to change all the orders continues.

This time it’s the CollectionsController’s showAction: you’d want to add the appropriate sort_field and sort_dir keys to the array passed to findBy there.

1 Like

Thanks!

It is my current obsession. :rofl: It’s an image collection with very limited metadata - the only descriptive metadata I’m guaranteed to have are Title and Creator, so I’m trying to impose a sort order that is sensible for the users. Descending date added would be confusing for them…

It’s a perfectly reasonable thing to want to do.

This is an interesting case, as we have easy places to alter the sorting through a plugin for the other places you’ve looked at, but not this specific one (it’s a little bit of an odd duck for a variety of reasons). It’s still possible with a plugin, but in a trickier way.

I know I’m not up to writing a plugin because my scripting skills are LONG out of date, having moved into management in the late 90s. I can still fake my way through writing SQL and editing JSON, PHP, and config files.

My other obsession is debugging an error in the BatchUploader plugin so it actually works for local file uploads, but that’s a whole 'nother discussion. We’ve been going around on why it’s making an incorrect PHP call…

Any idea why it would work for one collection but not another…

I’m re-indexing in case its something there.

Should work the same for any collection… unless you’ve done something like used Item Order for one and not the other, or something like that.