Page 1 of 1

Storing old orders in web shop

Posted: Mon Aug 29, 2005 1:05 am
by StumpDK
I'm currently working on a shop system in which customers creates orders which later is being processed by the shop owner (as usual in shops :) ).
When an order is processed, it is necessary to store in some way, so old orders can be looked up later.
My question is which way is the best way to store old orders. I could store it in the database with the original relations to the original items ordered, but this won't work as the item price, item description and so on will change over time.
As I see it, there is two opportunities: flat file system or a new database table.

Posted: Mon Aug 29, 2005 1:17 am
by feyd
option 3: add a simple flag to the order table and store the price used for each item.

Posted: Mon Aug 29, 2005 1:22 am
by StumpDK
In the order table? But there can be many items at each order. I would still have to create a new table then, or what?

Posted: Mon Aug 29, 2005 1:30 am
by feyd
no.. you add a price field to the item table, and the flag to the order table.

Posted: Mon Aug 29, 2005 3:59 am
by StumpDK
I have 3 tables:

Items

item_id
price
description

Orders

order_id
customer_id

Items_ordered

item_ordered_id
item_id
order_id


Items are joined with orders through items_ordered. The price in the item table are the current price, but that price will change once in a while, and therefore I can't set the old price in the items table because that would result in several old prices in the items table.

Posted: Mon Aug 29, 2005 7:02 am
by feyd
you store the price in your ordered items table.