Problems with the basket basket, sizing, etc.
I am working on a shopping cart and my problem is how do I create a database for sizing for products? T-shirts can be "XL, L, M, S", etc., and shoes can be "36,37,38,39 ... blabla". Should I only make one size chart or many tables for several types (T-shirt, shoes, etc.)?
Thanks in advance...
source to share
Table: size_selection
Item_id numeric
Item_size varchar
Seq numeric
Item_id -> item table (say id = 1 -> tshirt. Id = 2 -> shoes.)
So your table will be
Item_ID Item_size Seq
__________________________
1 S 1
1 M 2
1 L 3
1 XL 4
2 36 1
2 37 2
2 38 3
2 39 4
Then, on the page, just get the dropdown values ββlike
Select item_size from size_selection
where item_id = :p_ID
order by seq
The sequel to the sequel can vary depending on your taste.
source to share
I don't quite understand what you are thinking about wanting multiple tables. You may have hung yourself on the fact that some sizes are alpha and some are numeric.
If this is the reason, then forget it right away. There is no useful numeric value for different options like this, so they all have to be stored as varchar to support alphanumeric characters.
If you need to sort, then enter the sort order as well. It should be separate. Don't try to sort by element size itself - as far as your application is concerned, they are all just individual choices and not impotent that they are numeric.
source to share