Hey everyone,
I am designing a shopping cart for a pizza store and I can
store regular items that have no customization like a drink, pasta
dish, etc. I am stoing this using the usual arrays and structures
in which I have the structures holding the ProductID, Price,
Quantity, etc. But now for a pizza the trouble I am having is when
a customer order a Pizza they need to be able to customize:
Toppings and how they would like the toppings like Half,
Full, Double, etc. I will give an example below but I can't quite
get my head around how to store such a thing.
For example user clicks on the Pizza they want to order and
they get these choices via checkboxes:
Pizza with Cheese:
Pepperoni : (NONE, 1st HALF, 2nd HALF, FULL, DOUBLE)
Sausage : (NONE,1st HALF, 2nd HALF, FULL, DOUBLE)
Extra Cheese : (NONE,1st HALF, 2nd HALF, FULL, DOUBLE)
Mushrooms : (NONE,1st HALF, 2nd HALF, FULL, DOUBLE)
Now before my array and structure is built to handle storing
the like Pizza with Cheese, Quantity, Price but this kind of
customization I am not sure how will I store what each pizza has.
I am using this example sample that I saw for CDs:
MyCart = ArrayNew(1);
OneCD = StructNew();
OneCD.Title = "Cookin at the Plugged Nickel";
OneCD.Artist = "Miles Davis";
OneCD.Genre = "Jazz";
OneCD.Cost = "15.00";
OneCD.Quantity = "1";
AddIt = ArrayAppend(MyCart, OneCD);
AnotherCD = StructNew();
AnotherCD.Title = "Lady in Satin";
AnotherCD.Atrist = "Billie Holiday";
AnotherCD.Genre = "Blues";
AnotherCD.Cost = "14.00";
AnotherCD.Quantity = "2";
AddIt = ArrayAppend(MyCart, AnotherCD);
So the question is really what do I use as the StructKey? is
it the topping itself like
Pepperoni or is it more like the Type like
1st HALF, 2nd HALF, FULL?
Thanks