9

I would like to have 2 node types, Sellers and Products. Each seller can have many products, and each product can have many sellers. Also, the relationship between Sellers and Products would need to contain a price.

What would be the best way to create that relationship, making it easy to list all the Products a seller sells on their page (with prices), as well as listing all of the Sellers selling a product on their page (with prices)?

13

You can achieve by these two modules: Field Collection and Entity Reference,

You can create Field Collection field (unlimited instances) to Product, the collection field (act like a wrapper) contains an Entity Reference field references to Seller, and a price field for that seller.

Some screenshot for you:

enter image description here

enter image description here

enter image description here

enter image description here

5
  • I really love to see detailed answers like this one, great job (voted up)
    – frazras
    Jul 5 '12 at 6:15
  • Glad I can help. :)
    – gilzero
    Jul 5 '12 at 7:51
  • 1
    gilder your example worked perfectly. But do you know a way to easily have the associated list of prices/products displayed on the Seller page?
    – Itempo
    Jul 6 '12 at 21:24
  • gilder -> gilzero, stupid autocorrect :)
    – Itempo
    Jul 6 '12 at 21:57
  • @itempo. Yes. You can use Views Attachment, or EVA module
    – gilzero
    Jul 7 '12 at 1:41

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.