1

I have a bit of a complex relationship situation I'm trying to figure out in EE.

My channels consist of case-studies, clients, and services.

  • I have a relationship field within each case-studies entry where I relate a client and service.
  • Within the clients channel I relate items from the service channel.

I want to create tab-based clients page that lists clients segmented by the 4 services, with a link under each client to a page that lists their related case-studies.

Now I can list the clients fine, and the tabs are working the way they should, the problem I'm having is checking whether a client has related case studies or not and only displaying a link to that page IF that client has some related case-studies.

{exp:channel:entries channel="services" entry_id="4"}
<!-- I'm in the services channel, now I want to loop through the clients that are related to this service -->
  {parents field="client_related_service"}
    <div class="col-xs-12 col-sm-6 col-md-3 client-details">
    <p> <img src="{parents:client_logo}" class="img-responsive" alt="{title}"/></p>
    <p> {parents:client_description} </p>
    <!-- ONLY ADD THIS IF CLIENT HAS CASE-STUDIES RELATED TO IT, CAN'T FIGURE OUT HOW TO DO THIS-->
    <p> <a href="{site_url}index.php/clients/{parents:url_title}">See how we helped {parents:title}</a> </p>
    </div>
  {/parents}
{/exp:channel:entries}
2
  • You don't mention how your Case Studies are related to each client - via the Client entry, or via the Case Studies entry? – Derek Hogue Feb 6 '14 at 13:58
  • sorry if I wasn't clear but that's what I mean in the first bullet point. When I create a new case study I have a field where I choose the related client. – steve Feb 6 '14 at 15:05
1

Relationship tags are nest-able by continuing with the colon syntax:

{parents:parents field="case_study_related_client"}
<p><a href="{parents:parents:title_permalink="case-studies/index"}">See how we helped {parents:title}</a></p>
{/parents:parents}
0

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.