<p>With that last <code>{% set news = craft.entries.id(ids) %}</code> criteria model you're querying in one locale only
and there's no way to change that, Craft doesn't have a feature to set up a criteria model to query in multiple locales.</p>

<p>You'd have to merge the entry models themselves and use something like the <a href="https://topshelfcraft.com/lagniappe/supersort" rel="nofollow">Super Sort plugin</a> to bring them in order.</p>

<pre><code>{% set entriesA = craft.entries.section('news' ~ Section).relatedTo(active).ids() %}
{% set entriesB = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).ids() %}
{% set entries = entriesA|merge(entriesB) %}

{% set entries = entries|supersort('sortAs', '{postDate}')|reverse %}
{% set entries = entries|supersort('sortAs', '{stickyNews}') %}
</code></pre>

CC BY-SA 3.0
2016-04-01T13:02:16.693Z
Thanks Carl - that was the approach taken:

    {% set pages = [] %}
    {% set pages = craft.entries.section('news' ~ Section).relatedTo(active).localeEnabled(false) %}
    {% set newsAlum = craft.entries.section('newsAlumni').relatedTo(active).status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false) %}
    {% set pages = pages|merge(newsAlum) %}
    {% set news = pages | supersort('rsortAs', "{ postDate|date('Ymd') }") %}
Cole Henley
CC BY-SA 3.0
2016-04-01T11:15:19.483Z
2016-04-01T11:15:19.483Z
carlcs
<p>I've got a site with multiple locales and I want to merge together content from across these locales, eg News.</p>

<p>The two sections share the same fields so should theoretically be able to be sorted by a shared criteria.</p>

<p>Looking at the post at <a href="https://craftcms.stackexchange.com/questions/12522/how-do-i-sort-a-collection-of-entries-from-multiple-sections-by-date">How do I sort a collection of entries from multiple sections by date?</a> I can merge these both into a single array but when I try to post the <code>ids</code> from these into a new query (to sort the results) only one set of results are returned.</p>

<p>Sample code:</p>

<pre><code>{% set ids = craft.entries.section('news' ~ Section).relatedTo(active).ids() %}
{% set mergeIds = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).ids() %}
{% set ids = ids|merge(mergeIds) %}

{% set news = craft.entries.id(ids).localeEnabled(false).status(null).order(['stickyNews desc','postDate desc']).ids() %}
</code></pre>

<p>If I dump the results of <code>ids</code> I get:</p>

<pre><code>295484 | 3747 | 1787 | 1783 | 1781 | 1778 | 638 | 636 | 640 | 295486
</code></pre>

<p>295486 being the entry from <code>mergeIds</code> being returned.
However, if I dump the results of <code>news</code> I get:</p>

<pre><code>295484 | 3747 | 1787 | 1783 | 1781 | 1778 | 638 | 636 | 640
</code></pre>

<p>Leaving out the result from <code>mergeIds</code>.
Any thoughts on why the entries from <code>mergeIds</code> are not being included in the resulting <code>news</code> object?</p>

<p>Ta</p>

<p>Cole</p>

<localization><sorting><merge>
If merging two sections from different locales how do I then sort them by a shared criteria?
# If merging two sections from different locales how do I then sort them by a shared criteria?

(Asked by: username_0 on 2016-04-01)

I've got a site with multiple locales and I want to merge together content from across these locales, eg News.
The two sections share the same fields so should theoretically be able to be sorted by a shared criteria.
Looking at the post at How do I sort a collection of entries from multiple sections by date? I can merge these both into a single array but when I try to post the ids from these into a new query (to sort the results) only one set of results are returned.
Sample code:
{% set ids = craft.entries.section('news' ~ Section).relatedTo(active).ids() %}
{% set mergeIds = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).ids() %}
{% set ids = ids|merge(mergeIds) %}

{% set news = craft.entries.id(ids).localeEnabled(false).status(null).order(['stickyNews desc','postDate desc']).ids() %}

If I dump the results of ids I get:
295484 | 3747 | 1787 | 1783 | 1781 | 1778 | 638 | 636 | 640 | 295486

295486 being the entry from mergeIds being returned.
However, if I dump the results of news I get:
295484 | 3747 | 1787 | 1783 | 1781 | 1778 | 638 | 636 | 640

Leaving out the result from mergeIds.
Any thoughts on why the entries from mergeIds are not being included in the resulting news object?
Ta
Cole

**Tags:** localization, sorting, merge


---

## 1 answers

### Answer by username_1 on 2016-04-01. Score: 3 | Accepted answer

With that last {% set news = craft.entries.id(ids) %} criteria model you're querying in one locale only
and there's no way to change that, Craft doesn't have a feature to set up a criteria model to query in multiple locales.
You'd have to merge the entry models themselves and use something like the Super Sort plugin to bring them in order.
{% set entriesA = craft.entries.section('news' ~ Section).relatedTo(active).ids() %}
{% set entriesB = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).ids() %}
{% set entries = entriesA|merge(entriesB) %}

{% set entries = entries|supersort('sortAs', '{postDate}')|reverse %}
{% set entries = entries|supersort('sortAs', '{stickyNews}') %}

> **Comments:**
> **username_0**: Thanks Carl - that was the approach taken:      {% set pages = [] %}     {% set pages = craft.entries.section('news' ~ Section).relatedTo(active).localeEnabled(false) %}     {% set newsAlum = craft.entries.section('newsAlumni').relatedTo(active).status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false) %}     {% set pages = pages|merge(newsAlum) %}     {% set news = pages | supersort('rsortAs', "{ postDate|date('Ymd') }") %}  

---

