1
votes

I am trying to achieve something simple with Drupal. I have 3 content types (with example data):

Product
A (cat 1)
B (cat 2)
C (cat 3)

Package
D (cat 1)
E (cat 2)
F (cat 3)

Category
1
2
3

The 2 content types Product and Package have an Entity Reference field that points to Category.

I am trying to create a View in Table format that will produce these results which is very easily achieved with SQL syntax:

Category Product Package
1-----------A----------D
2-----------B----------E
3-----------C----------F

In Views I can establish the Relation between 1 content type (ie: Product) and the Entity Referency to Category. But how do I add the relationship with the Package Content Type ?

I cannot do this via Filters (Adding more Content Types) because it will duplicate my rows and they are not distinct.

I suppose this can be done somehow with Relationships but how do I relate the 3 content types by using the Category Field?

Any ideas?

2

2 Answers

0
votes

Use Relationships under Advanced options in views. If your base set of fields comes from Category, first add a Relationship to "Product". Then add a Relationship to "Package", when configuring the 2nd relationship make sure you select the previous relationship in the "Use Relationship" select dropdown that will appear near the top of the config modal.

0
votes

So as far as i understand to do this you must Add a view to show "Categories" and for "Categories" use twice a "Relationship" once with "Product" and once with "Package" for both you need the "use this relationship". I think this is what you are looking for. Excuse me if i have misunderstood