I know I am doing this wrong, so I’m hoping somebody here can help. This is a little complicated, so I will try to explain this as best as I can.
I have a table of products with an id and a title. A product can have many certificates and a certificate can have many products. So far, these are my tables:
products
certificates
product_x_certificate
Here’s the problem. I need to also be able to offer products together. So let’s say I have these products:
towels
clubs
hats
balls
On one certificate, I offer towels with clubs. On another certificate, I offer towels with hats, and yet on another, I offer hats with balls. To make it even more complicated, customers have choices for each certificate. So one certificate can have multiple offerings. For instance, customers have the choice between balls and hats or towels and clubs on certificate A.
I tried creating a table called product_x_product and the fields are a_id, b_id, certificate_id, but I am running into all sorts of problems trying to display what product is offered with what product.
Any help would be greatly appreciated.
Thanks
I think you have most of the tables that you need. In *Product_x_Certificate* you can have multiple certificate IDs and multiple product IDs which means you can have a set up like this:
This way you have one or many products per certificate which satisfies your first requirement. As for the same certificate having multiple groups of products – why not just make a new certificate ID? Then if you need to conceptually group them you could make CertificateGroup and Certificate_x_CertificateGroup tables such that:
Does this help?