Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
I guess you just "implyed" that this table existed, if not, well I think it's better to put all relevent stuff together.I would also Create another table with
ProductID | Discount
because then you have so muchmore "flexibility"
When you do a discount you change it in one place (table 4) and it does the job everywhere else.
PS : this' isn't accurate if you have "categories" of product, because then you would need the field category. It might sound stupide to make bunch of table like that, but worked pretty well in the end .
For the shopping cart, I won't use a table with the Product Name and Description. When showing the contents of the cart, I'll simply look that up in the permanent Products table. Now in the Orders Received table, I do store a product title in case it changes over time. That way I'll have a record of it as it was when they bought it. But, I figure that while shopping, they should see the most current description anyway, so I figure why bother storing it twice.
As for my promotional discounts and so on... yes, I'll probably have a table that stores all the current promo offers and what is needed to qualify. In the cart, I'll need to store with each item a promo code that it belongs to, if it belongs to any. I haven't fully thought this part through yet. I'm going to start working on all this in a couple weeks.
Thanks for the suggestion. What I want to do with promotional discounts gets much more complicated than a percent off or sale price of an item or category of items. That's not a problem, as I already have that done in a similar fassion. I want to have complicated discounts, applied automatically for promotions such as:
example A) Buy an item from category 1, and pick 2 free items from category 33.
example B) Buy an item from category 1, 2, and 10, and get $X or X% off
example C) Buy any 5 items from categories 5, 7, or 12, and get $X off of each item.
Doing this without using a database driven cart, would be very difficult if not impossible.
Swede78 wrote:
What information do you store in sessions?
as far as the shopping cart goes, pretty much everything. I actually just store the entire object into the session, makes it super easy.
but that may not be the best thing for a high traffic site...