3

I have a channel called "products" which contains a Playa field called "chemistry-group". This field allows a relationship between a product and one or more chemistries. For instance, "Copper Iodide" is related to the "Copper" and "Iodine" chemistry groups. No problems there.

For the sake of administration, the playa field needs to exist in the product channel.

What I need to do is create a page for each chemistry that will look in the products channel and list any products where a relationship exists.

I could do this with reverse_related_entries but since each product can be in more than one group I'm unable to use the native relationship field (as this only allows a single relationship - or have I gone nuts here?).

I'm having trouble getting my head around setting this up, can anyone help?

1 Answer 1

6

I've worked it out in a moment of clarity and by re-reading the excellent Playa documentation.

The tag pair I wanted was

{exp:playa:parents channel="products"}

So on my chemistry page I'd have something like

{exp:playa:parents channel="products"}
    <a href="/products/{url_title}}">{title}</a>
{/exp:playa:parents}

This shows me any entries from my products channel that are related to the entry I am viewing from the chemistry channel.

It was as simple as that!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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