Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Any tips on writing a shopping cart?

by Ovid (Cardinal)
on Dec 22, 2002 at 21:47 UTC ( [id://221773]=note: print w/replies, xml ) Need Help??


in reply to Any tips on writing a shopping cart?

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)

  • Comment on Re: Any tips on writing a shopping cart?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://221773]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-19 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found