Hi guys. I hope somebody can help me.
Recently added items in a collection are not correctly ordered from newest to oldest. I checked, and what happens is this: the date ordering it uses is 1/1/2000 > 20/1/2000. Because it is an alphabetical order and does not include zeros.
How can I correct that?
Hi jflatnes! No, I don’t use that plugin. Apart from plugins like Stats and that type, I only use Collection Tree. Indeed in the database it is correctly.
If you could guide me on which files to look at… those with the functions or builds that order the elements in the collections, I’ll look line by line to see if I can find the error.
By way of illustration, here you can see, on the right, the (incorrect) order that it generates in the collections:
OK, I think the problem here is pretty simple: the code for printing items in the collection on the show page doesn’t actually ask for the most recent ones, it just asks for a page of items while specifying no order. (If you’re curious, this code lives in application/controllers/CollectionsController.php in the showAction method.)
Sometimes this means you get them in order by most recent, but sometimes not: the database is free to give us any 10 (or whatever) items. A small change to this code to actually request the items in order by added date should fix the display so the items shown are in the same order as if you chose that order on the browse page.