0

I have 3 content types. Town, Hotel and Price. Hotel has a node-reference to Town, Price has a node reference to Hotel.

I'm trying to create a block view to use one the Town node page displaying a list of Hotel nodes in that town, together with the lowest Price (field_price of the Price node).

Is something like that achievable with views? I did manage to get a list of all hotels in a town by using a contextual filter, but I can't seem to get the additional step of getting the prices in the view.

A custom module would obviously be an option, but if it's possible with views, I would prefer that solution.

| improve this question | | | | |
1

You cannot create a relationship from Hotel to Price. You have to go the other way.

Create a block view of Price. Configure a Relationship on the node reference to Hotel (field_hotel), and make it required. Add Content:field_price (not using relationship) and Content:Title (using the relationship) to your display, Add a sort on field_price (Ascending).

To limit the display to the Town, create a Contextual filter on field_town, have it use the relationship, and set it to Provide default value:Content ID from URL.

Configure your block to display on the Town content type, and you are done.

| 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.