Thread

A complicated one. How can I get the entries of a Child of a Child of a Parrent Channel

January 10, 2018 5:06pm

Subscribe [2]
  • #1 / Jan 10, 2018 5:06pm

    bobural

    20 posts

    I have the following scenario:

    • child channel “Car Models” where I store all the car models I have.
    • relationship field to…
    • parent channel “Car Brand” where I store car brand. When I add an entry here I can select the car models relevant to that car brand I want as relationship. (ex. Ford brand entry has Ford GT and Ford Mustang as related entries from child channel “Car Models” )

    • a third channel “Car Reviews” with a channel form so a normal user can add a review in the front end

    • relationship field to…
    • channel “Car Brand”

    my questions. in the channel form I have a select to get all my Car Brand entry but I cannot get their child related entries from “Car Models” channel…

    For example: On the front-end a user writes a review using my channel form for channel “Car Reviews” and selects Ford brand to post a review…. but I do not know how can I get the entries related to Ford (Mustang, GT, etc) in this channel form.

    Any pointers would be highly appreciated.

    Thank you.

  • #2 / Jan 12, 2018 11:15am

    James Catt

    17 posts

    Can you not use categories for the car brand instead of a channel + relationships? That would make it super simple.

    If that doesn’t work for you, you might be able to do it with an embed, something like:

    {embed="my_embed_template" parent_entry_id="1234"} // where 1234 is the entry_id for the brand

    Then in the embedded template:

    {exp:channel:entries channel="carbrand" entry_id="{embed:parent_entry_id}"}
    
      {relationship_field}
    
        // great stuff about cars here
    
      {/relationship_field}
    
    {/exp:channel:entries}
  • #3 / Jan 12, 2018 6:42pm

    bobural

    20 posts

    Thank you James,

    I do not know if you or anyone else understood me but I did a small drowning - image: ()

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases