2

Echoing post from http://ellislab.com/forums/viewthread/236223/ as suspected error in user documentation.

Looking at the documentation for the new relationships functionality it says filtering by category is supported (3rd paragraph of introduction): http://ellislab.com/expressionengine/user-guide/modules/channel/relationships.html#accessing-parents

However this is not listed as one of the supporting parameters under http://ellislab.com/expressionengine/user-guide/modules/channel/relationships.html#id9 and does not seem to work when I try something along the lines of the following:

{parents field="minutes_partner" category="20"} {parents:title} {/parents}

Anyone know if category filtering supported in relationships and if so how can I achieve this without writing some crazy custom query or coding a plugin?

Cole

1
  • I think in that 3rd paragraph they might be referring to the control panel > publish form. There doesn't appear to be a category parameter for the parents tag pair. Commented Jul 10, 2013 at 3:59

3 Answers 3

1

Just had this precise problem.

Rummaged around and did a little hack to make this work.

Open this file

/system/expressionengine/libraries/relationship_parser/Parser.php

Look for:

$rows[$entry_id] = $data;

If you simply move this line to be the last line inside the foreach loop that starts

foreach ($entry_ids as $entry_id)

Then it works.

Your script may differ slightly, but my line moved from line #475 to line #520

1
1

Had a similar issue recently and I used an IF statement to solve the problem for me. Might help with others who find this page looking for similar answers.

To use the OP's example:

Trying to get the following to work:

{parents field="minutes_partner" category="20"} {parents:title} {/parents}

How I got around it:

{parents field="minutes_partner"}
   {if "{parents:categories}{category_id}{/parents:categories}"=="20"}
      {parents:title}
   {/if}
{/parents}

Hope this helps someone.

0

This hack does work for the parent output but the standard output does not work now. Any ideas?

Not working...

{campus} {campus:title} {/campus}

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.