3

I'm fetching entries from several different locales and merging them together into a single object.

I then want to sort these to be most recent entry shown first. Using Supersort and the custom sortAs method I can get this to work showing entries in ascending date order:

{% set sections = 'news' %} 
{% set locales = craft.i18n.getSiteLocales %}   
{% set pages = [] %}
{% for locale in locales %}
    {% set entries = craft.entries.section(sections).status(null).locale(locale.id).localeEnabled(false).find() %}  
    {% set pages = pages|merge(entries) %}
{% endfor %}        
{% set pagesSorted = pages | supersort('sortAs', '{ postDate.date }') %}

However, if I try to use the above with the custom rsortAs method then it does not work, just returning the entries in the order they occur within the pages object.

Any thoughts on what might be doing wrong?

3

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 away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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