I've got the following setup:

Product (node) -- relationshipProductSupplier (with fields price, MOQ) -- Supplier

Now, I'd like to create a view which displays all products with their suppliers inside one table row.

Product 1; 13USD; 500pcs; Supplier1
15USD; 300pcs; Supplier2

If I create a node view of products, it dublicates my products. So I've got:
Product 1; 13USD; 500pcs; Supplier1
Product 1; 15USD; 300pcs; Supplier2

If I create a relation view, it duplicates either the relationships before I add a relationship or the whole table after I add a relationship (a very complex duplication). Even though I ticked "Avoid node duplication" in Relationships.

What would be the correct setup here?

Or do I only need to make sure that there is one relationship like:
Product 1 -- Supplier1, Supplier2, Supplier3
How would I store the price and the MOQ?
(Since I can't use a field within the supplier because one supplier can offer several products).
Or do I have to have 2 directional relationships for this problem?

Bit confused on this use case :-S
Thanks in advance
Bye, Chris


naught101’s picture

Title:Having duplicates in views» Use rowspan to group table rows.
Project:Relation» Views
Version:7.x-1.x-dev» 7.x-3.x-dev
Component:Views» table style
Category:support» feature

I think your relation setup is correct. Your problem is with views. I don't think you can do what you want with views, because of the way views deals with duplicates: you could have all the suppliers listed in a single row, then all the prices, etc. but not supplier 1, price 1, blah 1; supplier 2, price 2, blah 2.

You can hide the "product" from display, and then use grouping in the table settings, which results in a mini-table for each product, with the product as the table caption. That might be enough to get you by, especially with some creative CSS, but it's a bit of a PITA, if you ask me.

What you really want is something like

| Product | Supplier   | Price | ...
| Product | Supplier 1 | $13   | ...
+ One     +------------+-------+----
|         | Supplier 2 | $15   | ...
|         |            |       |

AFAIK, views can't do this at the moment, but it's definitely something that would be nice to have.
Transmitter’s picture

Yes, that's exactly what I was searching for.

Thank you for clarification. Hope this will work in the future.

danielgeez’s picture

Just checking to see if there has been any development on this issue. I'm looking for a module or hack that will allow this to work. Thanks. ;)

anjjriit’s picture

Subscribe +1;

anjjriit’s picture

Found this module today Rowspan grouping.