<p>So, if I understand you correctly, you're trying to use the Model IDs channel as a middle man? If so, I think you would just need two steps:</p>

<p><strong>To get all SSDs from a Memory Entry</strong></p>

<pre><code>{% set modelIDs = craft.entries.section('MODEL ID SECTION HANDLE').relatedTo(entry).ids() %}
{% set ssds     = craft.entries.section('SSDS SECTION HANDLE').relatedTo(modelIDs).all() %}
</code></pre>

<p><strong>To get all Memory from an SSD Entry</strong></p>

<pre><code>{% set modelIDs = craft.entries.section('MODEL ID SECTION HANDLE').relatedTo(entry).ids() %}
{% set memory   = craft.entries.section('MEMORY SECTION HANDLE').relatedTo(modelIDs).all() %}
</code></pre>

CC BY-SA 4.0
2018-09-21T14:06:08.423Z
2018-09-21T14:21:35.720Z
2018-09-21T14:21:35.720Z
Peter Tell
<p>I am using the Many to Many plugin and wondering if the below is possible. </p>

<p>I have a channel called Model ID. Model ID is then related to two other sections, Memory and SSD. I want to be able to link entries from Memory to entries in SSD via the Many To Many Field within Model ID.</p>

<p>Below is a picture, edited, to show the field layout and the information I have within the Model ID entry. The information within the entry is what I need to pull in to my Memory and SSD section but can not figure it out.</p>

<p>I feel like I am missing something very simple that might not be in the read me document for the plugin. </p>

<p>Any help would be appreciated.</p>

<p>Thanks John </p>

<p><a href="https://i.sstatic.net/4HgYt.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4HgYt.jpg" alt="enter image description here"></a></p>

CC BY-SA 4.0
2018-06-26T15:50:35.657Z
Your issue can't be solved by this code? https://github.com/page-8/craft-manytomany/blob/master/README.md#template-usage you can use this field like every other relation field in Craft.
Robin Schambach
CC BY-SA 4.0
2018-06-26T16:10:58.397Z
The code there works just fine but links me to the Model ID, not to Memory or SSD section. I really feel like its an easy solution that I am not just understanding or seeing via templating.
jhoysa
CC BY-SA 4.0
2018-06-26T16:12:53.687Z
Uhm.. So you didn't try to just grab the field value and query for the related elements `{% set ssd = entry.fieldHandle.all() %}` replace fieldHandle with the handle of the specific field. It will return an array of elements. Is that what you are looking for?
Robin Schambach
CC BY-SA 4.0
2018-06-26T16:22:23.627Z
I am trying this but no luck - {% set modelIDs = entry.memoryModelIds %}

{% for modelID in modelIDs.all() %}
    {% set ssd = modelID.relationshipsSsd.all() %}
    {% for product in ssd%}
        {{ product.title }} - {{ product.url }}
    {% endfor %}
{% endfor %}
jhoysa
CC BY-SA 4.0
2018-06-26T16:26:03.027Z
I am currently in the Memory section trying to access information from the Model ID section. Here is the code I use to pull in the Model ID title: {% set modelIDs = entry.memoryModelIds %}

                                    {% for modelID in modelIDs.all() %}
                                        <li>{{ modelID.title }}</li>
                                    {% endfor %}
jhoysa
CC BY-SA 4.0
2018-06-26T16:30:01.227Z
I guess that's what the plugin enables you to do - otherwise the last code would be considered as wrong unless you insert the same field in your Memory section. The first code seems a little bit confusing
Robin Schambach
CC BY-SA 4.0
2018-06-26T16:34:29.627Z
Thanks Robin for the help! I think the plugin works as advertised in the Read Me file. I think I am pushing the extent of the field in my case.  Thanks again for the help and have a great afternoon!
jhoysa
<plugins><relations>
Many To Many Plugin Template Help
# Many To Many Plugin Template Help

(Asked by: username_0 on 2018-06-26)

I am using the Many to Many plugin and wondering if the below is possible.

I have a channel called Model ID. Model ID is then related to two other sections, Memory and SSD. I want to be able to link entries from Memory to entries in SSD via the Many To Many Field within Model ID.

Below is a picture, edited, to show the field layout and the information I have within the Model ID entry. The information within the entry is what I need to pull in to my Memory and SSD section but can not figure it out.

I feel like I am missing something very simple that might not be in the read me document for the plugin.

Any help would be appreciated.

Thanks John

[![enter image description here](https://i.sstatic.net/4HgYt.jpg)](https://i.sstatic.net/4HgYt.jpg)

**Tags:** plugins, relations
> **Comments:**
> **username_1**: Your issue can't be solved by this code? https://github.com/page-8/craft-manytomany/blob/master/README.md#template-usage you can use this field like every other relation field in Craft.  
> **username_0**: The code there works just fine but links me to the Model ID, not to Memory or SSD section. I really feel like its an easy solution that I am not just understanding or seeing via templating.  
> **username_1**: Uhm.. So you didn't try to just grab the field value and query for the related elements `{% set ssd = entry.fieldHandle.all() %}` replace fieldHandle with the handle of the specific field. It will return an array of elements. Is that what you are looking for?  
> **username_0**: I am trying this but no luck - {% set modelIDs = entry.memoryModelIds %}  {% for modelID in modelIDs.all() %}     {% set ssd = modelID.relationshipsSsd.all() %}     {% for product in ssd%}         {{ product.title }} - {{ product.url }}     {% endfor %} {% endfor %}  
> **username_0**: I am currently in the Memory section trying to access information from the Model ID section. Here is the code I use to pull in the Model ID title: {% set modelIDs = entry.memoryModelIds %}                                      {% for modelID in modelIDs.all() %}                                         <li>{{ modelID.title }}</li>                                     {% endfor %}  
> **username_1**: I guess that's what the plugin enables you to do - otherwise the last code would be considered as wrong unless you insert the same field in your Memory section. The first code seems a little bit confusing  
> **username_0**: Thanks Robin for the help! I think the plugin works as advertised in the Read Me file. I think I am pushing the extent of the field in my case.  Thanks again for the help and have a great afternoon!  

---

## 1 answers

### Answer by username_2 on 2018-09-21. Score: 1

So, if I understand you correctly, you're trying to use the Model IDs channel as a middle man? If so, I think you would just need two steps:
To get all SSDs from a Memory Entry
{% set modelIDs = craft.entries.section('MODEL ID SECTION HANDLE').relatedTo(entry).ids() %}
{% set ssds     = craft.entries.section('SSDS SECTION HANDLE').relatedTo(modelIDs).all() %}

To get all Memory from an SSD Entry
{% set modelIDs = craft.entries.section('MODEL ID SECTION HANDLE').relatedTo(entry).ids() %}
{% set memory   = craft.entries.section('MEMORY SECTION HANDLE').relatedTo(modelIDs).all() %}


---

