modx-ccc-2015 / whishlist

The overall repository with MODX issues to tackle together at the MODX CCC 2015. This place is ment to be as a big pond of possibilies.
0 stars 0 forks source link

[getResources]: Sort output order of resource IDs like input order AKA keep the sequence alive #30

Closed mindeffects closed 9 years ago

mindeffects commented 9 years ago

Problem Once in a while I use getResources with a specific order of IDs, like for "show me related items which are stored in a TV as a comma separated list". The input order &resources=34,22,108``represents the importants of the resources, so the output should have this order to. But getResources is a little bitchy on that.

Fix In getResources this is possible to do with a trick: &sortby=FIELD(modResource.id, 34,22,108 )`` But this means that you have to double the ID list for "&resources" and "&sortby". Not that hard but also not really elegant.

Enhancement Creating a sort option like &sortby=resources`` which uses the "&resources"-IDs for the sorting.

pepimpepa commented 9 years ago

We are going to start with this:)

bartholomej commented 9 years ago

Fixed and PR Jason's repository https://github.com/opengeek/getResources/pull/97;)

Now you can use it like this: [[!getResources? &resources=4,3,2,5&sortby=resources&tpl=tpl.item]] OR [[!getResources? &resources=4,3,2,5&sortby={"resources":"DESC"}&tpl=tpl.item]]

JensWolff commented 9 years ago

@mindeffects will be happy :) Thanks, guys! :+1:

bartholomej commented 9 years ago

Merged ;)

mindeffects commented 9 years ago

Yes, very happy! THANKS A LOT! Now only @drumshaman (Jason) has to approve it, right?

renekopcem commented 9 years ago

@mindeffects Nope, it has been already merged, thanks to @TheBoxer :smile:

mindeffects commented 9 years ago

Sweat mother of pie! Great! Thanks you, @TheBoxer!