<p>Not sure if this solves your problem, but you could try this:</p>

<pre><code>{% set allMatrixBlocks = entry.matrixFieldhandle1.find | merge(entry.matrixFieldhandle2.find) %}

{% for block in allMatrixBlocks %} My stuff {% endfor %}
</code></pre>

CC BY-SA 3.0
2015-02-27T13:13:05.747Z
It didn't work, because it isn't array.
Dominik Krulak
CC BY-SA 3.0
2015-02-27T15:24:21.423Z
Sorry, updated my answer to include `.find`. That will convert each field into an array of matrix blocks. In some cases, Craft will automatically convert an ElementCriteriaModel into an array if it's being treated as an array... I wasn't sure if this was one of those situations (apparently it isn't).
Lindsey D
CC BY-SA 3.0
2015-02-27T20:20:17.503Z
It works as it should! :)
Dominik Krulak
CC BY-SA 3.0
2015-02-26T23:02:53.467Z
2015-02-27T15:21:34.460Z
2015-02-27T15:21:34.460Z
Lindsey D
<p>I'm struggling to get an element criteria model of more matrix fields at once for entry related to tagField.</p>

<p><strong>Example:</strong>
I have two matrixFields, where I want them in <code>{% for block in entry.matrixFieldhandle %}</code> loop.</p>

<p>I could do </p>

<pre><code>{% for block in entry.matrixFieldhandle1 %} My stuff {% endfor %}
</code></pre>

<p>and </p>

<pre><code>{% for block in entry.matrixFieldhandle2 %} My stuff {% endfor %}
</code></pre>

<p>but it's kind of silly to always set element model for each field. Anything simpler?</p>

<p>Couldn't find anything explanatory in documentation or here.</p>

CC BY-SA 3.0
2015-02-26T20:27:27.893Z
I'm not sure I follow... Wouldn't you just output them back-to-back? Don't your matrix fields contain different block types, and therefore have different requirements for being displayed?
Lindsey D
CC BY-SA 3.0
2015-02-26T20:54:08.073Z
Question updated. I have the field's structure strictly set to met my needs for site. Matrix field(set according to categories) -> Block type -> Field
Dominik Krulak
CC BY-SA 3.0
2015-02-27T04:59:13.150Z
Instead of creating multiple matrix fields and trying to merge them, I would suggest simply creating a new 'block type' within the same matrix with different fields defined. That is the beauty of matrix fields!
Douglas McDonald
<matrix><entry>
Is there a way to output more Matrix fields than one?
# Is there a way to output more Matrix fields than one?

(Asked by: username_0 on 2015-02-26)

I'm struggling to get an element criteria model of more matrix fields at once for entry related to tagField.
Example:
I have two matrixFields, where I want them in {% for block in entry.matrixFieldhandle %} loop.
I could do 
{% for block in entry.matrixFieldhandle1 %} My stuff {% endfor %}

and 
{% for block in entry.matrixFieldhandle2 %} My stuff {% endfor %}

but it's kind of silly to always set element model for each field. Anything simpler?
Couldn't find anything explanatory in documentation or here.

**Tags:** matrix, entry
> **Comments:**
> **username_1**: I'm not sure I follow... Wouldn't you just output them back-to-back? Don't your matrix fields contain different block types, and therefore have different requirements for being displayed?  
> **username_0**: Question updated. I have the field's structure strictly set to met my needs for site. Matrix field(set according to categories) -> Block type -> Field  
> **username_2**: Instead of creating multiple matrix fields and trying to merge them, I would suggest simply creating a new 'block type' within the same matrix with different fields defined. That is the beauty of matrix fields!  

---

## 1 answers

### Answer by username_1 on 2015-02-26. Score: 4 | Accepted answer

Not sure if this solves your problem, but you could try this:
{% set allMatrixBlocks = entry.matrixFieldhandle1.find | merge(entry.matrixFieldhandle2.find) %}

{% for block in allMatrixBlocks %} My stuff {% endfor %}

> **Comments:**
> **username_0**: It didn't work, because it isn't array.  
> **username_1**: Sorry, updated my answer to include `.find`. That will convert each field into an array of matrix blocks. In some cases, Craft will automatically convert an ElementCriteriaModel into an array if it's being treated as an array... I wasn't sure if this was one of those situations (apparently it isn't).  
> **username_0**: It works as it should! :)  

---

