0

Just wondering if anyone has a solution for this.

I want relationships between two channels... nothing fancy. But in the CP I want from both channels to be able to create the relations.

Say I have the channel Bakery and Bread. 1: From the bakery I want to be able to add one or more breads. 2: From the bread I want to be able to add a bakery.

Right now I could do this by adding a relationships field to both of the channels and point them to the opposite channel. But both fields won't know of each others existence thus not displaying the relations made in the opposite channel.

I think this is probably because of the ability to sort the relations. But that feature is something we don't need for this specific problem.

I hope I made clear what I need :) hopefully someone knows of a solution.

  • I have a module in development for this exact use case. No specific ETA, but feel free to get in touch for more info! – Michael Rog Jan 14 '14 at 0:16
  • Yeah, sounds cool. – Dion Snoeijen Jan 14 '14 at 18:29
2

I wrote something nice about this the other day for someone. It can be done in EE without plugins and is pretty straight forward.

I hope it helps.

https://expressionengine.stackexchange.com/a/18229/1872

| improve this answer | |
  • Looks like an interesting idea, I will try this to see if it works. – Dion Snoeijen Jan 14 '14 at 18:24
1

You might be able to do this with a plugin (maybe Playa), but EE won't do this out of the box.

Really, EE wants you to do relationships one-way. Either set up a bakery to select types of bread OR for each bread-type, say which bakery it's available at.

Any particular reason it needs to be both ways? It might seem easier, but it ends up being confusing.

| improve this answer | |
  • Ah, many reasons, I also don't see why it would be confusing per se, it totally depends on the situation. I think the option to be able to do this is very important. – Dion Snoeijen Jan 14 '14 at 18:33
  • Well, you're duplicating data. If you put five types of bread on the shop's page (in the shop channel) ... but then add a shop to ten types of bread (in the bread channel). Are you showing all ten on your front end? Or just the ones that are common between the two? Are you familiar with Stash? You might be able to use that. Export both relationship lists to a Stash list, and then in your template, display only the unique entries in the list. – SamC Jan 14 '14 at 21:11
  • Hi SamC. I don't think you understand my problem completely. It's about the backend. There are situations where you wan't to see what's related to what regardless of parent / child. Edit the parent -> See the related children. Edit the child -> See the related parents to put it like that. It's about wanting to be able to create many to many relationships, not just one to many. – Dion Snoeijen Jan 15 '14 at 18:25

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.