4 votes
Accepted

How can I let the user activate a particular SuperSort filter

So in order to do this you have to reformat your code and your strategy a bit. You cant provide a Craft query as a link, all that does is grab an array from the database and it won't inherently print ...
user avatar
4 votes
Accepted

Sort entries by global variable category

One solution is to retrieve the entry ids for the season entries and all entries separately; subtract the 'season entry ids' from 'all entry ids' (using craft's without twig filter); then merge the ...
user avatar
4 votes

SuperSort - Sort by multiple variables

I was able to accomplish this by just adding both variables to my SuperSort tag. In essence, what I did was this: {% set fruits = fruits | supersort('natsortas', '{count} {title}') %} It seems to be ...
user avatar
4 votes
Accepted

Paginate entries when I do not have a criteria model?

This is in no means an elegant solution, and can almost certainly be improved. But it did its job just fine. {% set veterinarians = craft.entries({ section: 'veterinarians', order: '...
user avatar
  • 35.8k
3 votes
Accepted

Using Supersort with date field

Thanks for asking about this, Cole! There was a bug that was causing rsortAs to return erroneous results. The issue is fixed in the 1.0 release. Grab yourself a fresh copy and you should be squared ...
user avatar
  • 3,390
3 votes

Sorting an array of entries according to a fixed list/array of items

Edit: This strategy still works, but see my updated answer for more up-to-date solution. Prior to SuperSort 3.1.0, you might achieve this by using the replace filter inside SuperSort's micro-template: ...
user avatar
  • 3,390
3 votes
Accepted

Using `getPrev` and `getNext` with entries sorted by SuperSort plugin?

It won't work with getPrev and getNext, as they only work with ElementCriteriaModels and not with an array of Entry models. But that is what you get returned from the plugin. Supersort converts your ...
user avatar
  • 35.8k
2 votes

Using `getPrev` and `getNext` with entries sorted by SuperSort plugin?

On natsort... When you're sorting a list of entries, the items being sorted are EntryModel objects. The natsort filter won't be very helpful in that case, because natsort is expecting string inputs. ...
user avatar
  • 3,390
2 votes
Accepted

Sort entries by custom date in Matrix field / Super Table

I did something like this as a workaround: Loop over entries, fetching all data you need and adding it to an array. Sorting that array with SuperSort and than displaying all info by looping over the ...
user avatar
  • 1,456
2 votes

Sorting SuperTable Field with SuperSort?

I think you need to add 'object' to your syntax if you're using {{ }}: {{ object.tourDates.tourDate }} Else it's { tourDates.tourDate } I believe. See the plugins docs under Advanced sorting.
user avatar
  • 1,456
2 votes
Accepted

Retrieve entries by random sort, then resort alphabetically

I recon Supersort is they way to go, as its got some really handy functions to make this sort of thing a breeze. Try with the following: {% set entries = craft.entries.section('presenters').order('...
user avatar
  • 3,392
2 votes
Accepted

Sorting multi-dimensional grouped arrays

Not really an answer that fixes the question per sé if anyone else has the same issue, but none the less the answer that worked for me was simple: Split up your sorting where possible and simplify ...
user avatar
  • 1,456
2 votes
Accepted

Multisort with supersort plugin

Try to group the entries sorted by size using the group filter: {% set entriesSorted = entries|supersort('sortAs', '{ size }', SORT_NUMERIC) %} {% set entriesByBrand = entriesSorted|group('brand....
user avatar
  • 35.8k
1 vote

Sort entries by custom date in Matrix field / Super Table

I used the preparse plugin to save a date value from a SuperTable field into a static field as 'yyyymmdd'. I could then sort my entries based on that static field.
user avatar
1 vote

Custom sort order?

I would like to thank Michael Rog for supplying an answer at this similar question about SuperSort: Sorting an array of entries according to a fixed list/array of items The code that lets me sort by ...
user avatar
  • 138
1 vote

How do I access a specific element of a supersorted array?

Further to Jalen's answer, if you want to preserve your array keys, you can use this: {% set sortedArrayKeys = mySortedArray | keys %} and then access any item with mySortedArray[sortedArrayKeys[...
user avatar
1 vote
Accepted

How do I access a specific element of a supersorted array?

If you run mySortedArray through the | values filter, it will reset the keys: {% set mySortedArray = myArray | supersort | values %} mySortedArray = array(6) { [0]=int(1) [1]=int(2) [2]=...
user avatar
1 vote

SuperSort `rsortAs` error with `postDate`

Figured it out, needed to format the postDate object accordingly: {% set products = products | supersort('rsortAs', '{ postDate | date("U") }') %}
user avatar
1 vote
Accepted

Supersort - Sort multiple variables together

Managed to do this by putting it all into an array: {% set productID = [] %} {% set orders = craft.orders().limit(null).all() %} {% for order in orders %} {% for item in order.lineItems %} ...
user avatar
  • 407
1 vote

Using a matrix Date/Time field to sort entries

So you're not getting your matrix field's value properly. You're going to want to access it the same way you'd output the data: {{ event.dates.type('date').first().startDate.getTimestamp() }} So ...
user avatar
1 vote

Sorting multi-dimensional grouped arrays

It's a bit hard to help as you didn't provide any code. But I suggest to apply the supersort filter before grouping by the department property. {% set usersSorted = users|supersort('sortAs', '{{ ...
user avatar
  • 35.8k
1 vote

SuperSort - Sort by multiple variables

I just gave it a play and found a simple solution to get them ordered by count in descending order and them by title in ascending order: {% set fruits = fruits|supersort('natsortas', '{{ (9999-object....
user avatar
  • 35.8k
1 vote

Sorting an array of entries according to a fixed list/array of items

As of SuperSort 3.1.0, you can use the customOrderSort and customOrderSortAs methods to accomplish this: {% set shops = craft.entries.section('shops')... %} {% set customOrderList = [ '...
user avatar
  • 3,390

Only top scored, non community-wiki answers of a minimum length are eligible