2

I'm trying to use supersort to sort my entries based on date values in a supertable field.

This is what I have so far but it's not working.

{% set artists = craft.entries.section('artists') %}
{% set entries = artists | supersort('sortAs', '{{ tourDates.tourDate }}') %}

tourDates is the supertable handle tourDate is the date field in the table. There can be multiple date entries in one table so it would need to bring them out in order as well.

I'm not sure this is even possible.

1 Answer 1

2

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.

4
  • Tried both of those but neither worked.
    – Lettie
    Commented Jun 6, 2017 at 13:47
  • Well, it may not be a perfect solution, but today I needed something similar. What I've done (suited my situation best): I fetched all entries and added all the info I needed, including a superTable field in a matrix, as attributes of an object to an array. At the end I just looped over the array and outputted all the object attributes. It was very easy to sort that array suing superSort by one of those attributes. Commented Jun 6, 2017 at 14:13
  • You did this in twig or in a plugin?
    – Lettie
    Commented Jun 6, 2017 at 14:21
  • I did this in Twig. Commented Jun 6, 2017 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.