Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Search Results, Many_Many Relationship Data


Reply


2 Posts   890 Views

Avatar
stew

Community Member, 30 Posts

28 July 2010 at 10:15pm

Hey guys,

I'm trying to get the final problem solved before I can get the project I've been working on launched.

The main issue with searching was resolved thanks to Barry in the thread further down the page, however I've been left with one last little niggle that I just can't find the answer to.

Each search result is that of an Organisation which may have a Venue, the Venues are controlled through a many_many relationship since quite a few Organisations share a venue. The problem I have is that I can't get the actual data of the Venue outputted on the search results page, I have tried the usual <% control Venues %> bit but that didn't work.

Does anyone know how to do this? I could just add in a new batch of fields for the venue details in the Organisation DataObject but I'd rather keep them separate since so many of the Organisations share venues it seems daft to make the client reenter the Venues so many times.

Thanks,

Stewart

Avatar
stew

Community Member, 30 Posts

28 July 2010 at 10:24pm

Thought I'd add a wee bit of code in that might help explain what I am trying to do.

This is in OrganisationHolder.ss, basically if a Venue is attached to the Organisation it gets the Latitude and Longitude of the Venue and outputs it, if not it gets it from the Organisation object itself:

            <% if Venues %>
                  <% control Venues %>
                        <li class="map-location" data-jmapping="{id: $ID, point: {lat: $Latitude, lng: $Longitude }, category: '$MapCategory'}" style="width: 100%;">
                  <% end_control %>
               <% else %>
                  <li class="map-location" data-jmapping="{id: $ID, point: {lat: $Latitude, lng: $Longitude }, category: '$MapCategory'}" style="width: 100%;">
               <% end_if %>

I need to get the exact same result in the Search_Results.ss but it's not working :S