Introduction

The goal is to setup a database with relations between nodes. That can be a product database or a location database. The critical point is: The relation should hold data as well.

SalesChannel C --- (Price K) --- Product A --- (Price X) --- Supplier V
SalesChannel D --- (Price L) --- Product A --- (Price Y) --- Supplier W

From this data, a view/table should be generated which displays all information correct without duplicates.

Notes:

Commerce couldn't hold data in the relation, even though product variations seem to aim at this scenario.
Entitiy Reference (as well as other reference modules) seem unable to store data in a reference as well.
Views and Relation alone are insufficient since a view of all products will generate duplicates if relations with their data and endpoints are to be displayed as well.

Assumptions:

For this tutorial experience with Views and Relation is required.

Modules needed

Views
Relation
EVA
Views Field View

Instruction

After enabling the required modules, the three content types can be created which is pretty straight forward.
Content Types
Now the relations have to be created. This will be two relations, not directional, including two content types (product/supplier and product/sales channel). More over those relations need to have extra fields where things like prices, minimum order quantity etc. gets stored.
Relation
Relation Fields
Relation Details

After adding some content for testing (make sure that at least 2 products, each with two suppliers and two sales channels exist - so 2 products, 4 suppliers, 4 sales channels - just to be ready for a first test) it's time for adding a view as a field into the product content type.

Therefor a new view has to be created as following:
EVA View
Make sure that in the contextual filter the relationship is used.
The fields that are displayed come from the relationship. The contextual filter value comes from another view that will be created later on.

Another view can be added for displaying the related nodes. This can be a page or an attachment. It needs to contain the relationship and simply display the required fields.
Page View

Now, the EVA view should add a field to the selected content type which is visible on the field display site of the content type. Viewing a node should display the included and newly created view inside.

Finally a view has to be created which should display all nodes with the data from the relation and the associated nodes in a table.
Table View
The important thing for this view is: The fields (Global View which comes from the Views Field View) need to forward the node ID to the associated view.

This view shall display all information related to the selected content type (products for instance).

Happy database building.

References

Tutorial on EAV
Tutorial on Relation

AttachmentSize
05.jpg96.7 KB
06.jpg96.41 KB
07.jpg55.63 KB
08.jpg93.68 KB