如何实现不同重量的相同产品

I don't know if this question should be here or not but i don't see any other place fit to ask my problem.

See, i am developing an online food portal which obviously sells food , snacks ,cakes and desserts.The real deal comes up when i have to sell a cake which can exist in various weights such as 0.1|0.5|0.9|...4.5 and every one of them costs different.Furthermore, every one of them are present in different quantities in warehouse.

My solution to achieve this was to provide a different row for every variant

ID | product_code | product name | Quantity | price | weight | company_id 
1  |  12345       | beer cake    |   34     |345    |0.5     |343434defee
2  |  12345       | beer cake    |   343    |600    |1.0     |343434defee
3  |  12345       | beer cake    |   4      |845    |1.5     |343434defee
4  |  12346       | vodka cake   |   341    |345    |0.5     |343434deereee

Here , i looked every product to be a different product,I provided the relation using product code while to differentitate every row , i choose id,product_code as the primary key.

But, using this method involves redudancy as well, every row is looked as a different product.So if i were to display them using php it would show them as different product.

Something like this,

enter image description here

How do i change my structure of my database in order to achieve a single product but with different variants option on the same item?

I could use a php solution , if it's there.

Regards,

BOTjr.

Split the table into two with product_code as foreign key.

Table One
    ID | product_code | product name | company_id 
    1  |  12345       | beer cake    |343434defee
    2  |  12346       | vodka cake   |343434deereee

Table Two
       Product_code |Quantity | price | weight 
       12345        |  34     |345    |0.5 
       12345        |  343    |600    |1.0 
       12345        |  4      |845    |1.5 
       12346        |  341    |345    |0.5 

Use Table One to display items, Use Table Two is product description page to select the right quantity