0

I have 3 content types:

  • Country
  • Destination
  • Attraction

Each attraction has an entity reference poiting to Destination. Each destination has an entity reference poiting to Country.

I need to create a view in a block, published on all content types Country that lists all Destinations within that country and the number of attractions within each Destination. For example, France destinations are Paris and Marseille. Paris has Eiffel Tower, Louvre and Pont Neuf as attractions. Marseille has Chateau d'If and Panier as attractions. In my country node I should be able to print: Paris (3) Marseille (2) I only need the title and that particular number, with links on title going to their specific nodes.

How could that be achieved? I was thinking about aggregation but I have tried to do so and failed. Thank you!

1 Answer 1

0

try:

under Advanced Tab, create a relationship. the type will depend on your field names exactly, but if the view is for the country, you should be able to find the destination and attraction fields available.

the new related fields should show up now in your Fields list and you can add them to the view

For the count, try the following:

Entity Reference Count or Entity Reference Calc or take a look at this on SO

2
  • Thanks, Geoff! My country block view has a relationship that pulls destinations via field_country. So each destination points to a country and the field is field_country. I've managed to show destinations for each country in a block, as titles. But I can't get the number of nodes pointing to each destination. Here is my view: i.imgur.com/s7gSLRr.png And there is my country page, block included: i.imgur.com/IClVeA2.png Field names are field_country inside my node add form for destination and field_destination inside my node add form for attractions.
    – Catalin
    Commented Aug 1, 2014 at 14:12
  • I updated my answer
    – Geoff
    Commented Aug 1, 2014 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.