Projection query comparing two content types with the same content picker fields

82 Views Asked by At

I would like to list deals that are available in a specific city. I am using a content picker field to link the properties to deals and cities.

I have three content types, two of these content types have a content picker field that connects the property:

  • City (with a ContentPicker Field allowing properties to be selected)
  • Property
  • Deal (with a ContentPicker Field allowing properties to be selected)

Properties are linked to deals as follows:

  • Deal 1 = property 1
  • Deal 2 = property 1
  • Deal 3 = Property 2

Properties are linked to cities as follows:

  • City 1 = property 1
  • City 2 = property 2, property 3

So the result that I would like to get is:

  • City 1 - Deal 1 and 2 should display
  • City 2 - Deal 3 should display, because property 2 exist in the properties selected for this city.

See example of content types created

See example query - On the city page I have a projection with a query that finds all the deals that that have the same properties as the current city.

From what I can tell, the problem is that '{Request.Content.Fields.CityTown.Properties}' is not giving me the selected ID's in a list form like this '2','3'. Therefor if my city is connected to more than one property it does not return any results because it does not match '2,3'. If I add property 3 to deal 3, it gives me results, because '2,3' is equal to '2,3', It works with direct matches, but it does not check if the Property Id's listed for deals exist within the Property Id's listed for the current City to give me the deals for the city. Hope that makes sense.

The trick is that I want to use existing functionality within the Orchard CMS system. I do not want to code custom modules etc. I am hoping there is an easy way around this.

0

There are 0 best solutions below