We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Grid field inside of Relationship field = random result?

Development and Programming

rzerb's avatar
rzerb
7 posts
about 6 years ago
rzerb's avatar rzerb

Hi! Hoping for insight.

Perhaps something changed recently that has caused my Grid fields inside of a Relationship entries not to display. I am on EEv5.3.0 and nothing has changed in my code/content to cause this issue (that I know off…). Here is a simplified snippet of my code with the issue commented:

{exp:channel:entries channel="channel_with_relationship_field"}

  {relationship_field}

    {relationship_field:title} // The title renders fine from the relationship entry as well as other fields...

    {if relationship_field:grid_field} // ...except grid fields. Not even recognized

    {relationship_field:grid_field} // Sometimes, it will find a Grid field even if the entry doesn't actually have one!

      {grid_field:grid_field_label} // It's a rare thing if this gets rendered.

    {/relationship_field:grid_field}

    {/if}

  {/relationship_field}

{/exp:channel:entries}

More info: The channel entries that is being pulled by Relationship field has 3 Grid fields. Out of 10 entries, only 3 use those Grid fields. These are the purposes of those Grid fields:

  • Show image with a link to a file or URL
  • Show a button with a link to file or URL
  • Show a list of links to file or URL

I have tried the following approaches:

  • Simplified the code on a test page.
  • I reordered the Relationship entries. No change.
  • I printed the entry_id for the Relationship entries and they all check out.
  • I created a new Relationship field and populated it with the same entries that have the Grid fields. Still not finding the Grid fields
  • I created one new Grid field (without deleting old ones) and it found the Grid and rendered its stuff.
  • I created additional Grid fields to mimic the other 3 fields and none of them rendered.

I am not sure what to try now. If the functionality changed, then is there another approach to render a list of channel entries on a page that have a sub-listing of things to render? Maybe Fluid field?

Thank you in advance, -Reid

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
about 6 years ago
Robin Sowell's avatar Robin Sowell

Is it just the conditional that’s an issue or is it not actually showing the content?

       
rzerb's avatar
rzerb
7 posts
about 6 years ago
rzerb's avatar rzerb

Thanks for the reply Robin! I believe the conditional is fine. I usually add those conditionals to make sure there is content there before rendering the goods. I even removed it to see if the Grid would show and it unfortunately didn’t. -Reid

       
rzerb's avatar
rzerb
7 posts
about 6 years ago
rzerb's avatar rzerb

I have more information! (another piece of the puzzle).

I just experienced the same issue on a different page that is set up similarly (Page > Relationship > Grid = can’t render/find grid). The Page was working fine until I added a new field to the channel that the Relationship field points to, and added text to it. Does any of that make sense? It’s really starting to feel like a bug now. The new field that I added to the channel in the Relationship field was a TextInput and that renders fine. It’s just that now, the Grid fields that were in that channel aren’t recognized anymore.

Is there a way for me see if there are any EE errors on the page without turning it on for the whole site? I wouldn’t want to disturb the viewer’s experience.

Thanks again and I hope this is making sense to someone -Reid

? 1
       
jim n's avatar
jim n
5 posts
4 years ago
jim n's avatar jim n

rzerb - I was able to achieve writing conditionals on relationship fields called from a fluid grid parent only by using custom ee queries – and then using the declared result in a conditional. Such as:

{exp:query sql="SELECT field_id_185 as testfoo FROM exp_channel_data_field_185 WHERE entry_id = '{content:modal:entry_id}' LIMIT 0,1000"}
     {if testfoo != ''}
        <h2 class="button"><a href="http://{content:modal:modal-request-info-url}" class="icon-angle-right">Request Info</a></h2>
      {/if}
   {/exp:query}

This was not optimal, but it did the job in a pinch. I’m pretty sure there is/was a bug in 5.x.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.