For my e-commerce website , I am trying to multiple combination of a product variant .
For Example :
Product : Shirt
Combination of the Variant : Size and Color
Product : Mobile Phone
Combination of the Variant : RAM , Storage Capacity , Colors
Product : Fruits
Combination of the Variant : Weight
and keeps on varying based on each product - so how could I dynamically upload the variants of these products . How should I design my database to accomodate such a requirement.
Hello
If you mean to make the product and its features dynamic. We did this and made a separate table for each feature and connected them using relationships. It was a very complicated task. Of course, we are very amateurs.
I hope I was able to help
@Tray2 I tried the One-To-Many -> But I ran into another confusion .
So now the combination of each property would have different price ranges . How do we achieve that piece.
For Example
Product : Mobile Phone
Combination of the Variant : RAM , Storage Capacity , Colors
@priyalaks They should each have a unique product_id.
iPhone 32Gb Color White
iPhone 32Gb Color Blue
iPhone 64Gb Color White
and so on, each product can have one or more properties, I would however not put the price as a property, that should either be in its own table or in the products table, I would probably go with it's own table for track-ability.
It means that you have the following in your properties table
pid property value
1 color white
1 ram 32Gb
2 color blue
2 ram 32Gb
3 color white
3 ram. 64Gb
@priyalaks I’ve answered this a question a few times here on Laracasts.
Basically, you want three models: a product model, an attribute model, and a SKU model. You can then create a pivot table between attributes and SKUs where you have a pivot column holding the value for an attribute and SKU combination.