This tip may seem a bit silly, but I've seen people bitten by this, so I thought I would mention it. I'm sure you're aware of this, but just in case ...
In a properly normalized database, data should usually be represented in one and one one place. As a result, when creating an order_item table, it seems to make sense to merely provide the product id in that table and lookup the price via a join. Unfortunately, this doesn't work. The price at the time of the sale (and perhaps other things) needs to be stored directly in the order_item table lest the customer be charged a different amount due to a price change. This is not denormalizing the database because price at the time of sale is similar, but not identical to, the price of a given item.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
In reply to Re: Any tips on writing a shopping cart?
by Ovid
in thread Any tips on writing a shopping cart?
by BrentDax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |