0

I have two channels, Destinations and Hotels

Within the Hotels channel, I have a relationship field called hotel_destination, which relates it to the destination channel.

Now, on the hotel entry page/template, I'm struggling in being able to list the other hotel entries that are also related to the same destination.

Example. If Hotel 1, Hotel 2 and Hotel 3 were all related to Destination 1, then on the Hotel 1 entry page, I'd like to be able to display a listing of Hotel 2 and Hotel 3, as they are also related to Destination 1. Likewise if I selected the Hotel 2 entry page, I'd want to see Hotel 1 and Hotel 3.

The ultimate aim is to have the 'sibling' hotels listed in a sidenav of sorts, so that users know which other hotels are in a given destination.

I read and played around with the Relationship field with no luck and hoped someone might point me in the right direction

Thanks

  • 1
    can you please post some of your code so that we can see how you are trying to go about displaying the info? – pixldev Jun 15 '17 at 0:03
1

I'm pretty sure that this example pulled right from the relationships docs will work for you:

{exp:channel:entries channel="hotels"}
  {hotel_destination}
    {hotel_destination:siblings field="hotel_destination"}
      {hotel_destination:siblings:title}
    {/hotel_destination:siblings}
  {/hotel_destination}
{/exp:channel:entries}
| improve this answer | |

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.