Jump to content

db design when ordering items


zszucs

Recommended Posts

I'm putting together an online ordering sysytem.  The problem I'm having is that the client wants to edit products but not change prices in the order history as a result of the edit so the prices there would be accurate for the time.  I think this can be overcome by adding the product_price in with the order_detail.  The problem is when they want to delete products.  If they delete them, the order history would either get deleted with the product getting deleted if it was ordered or leave it as orphaned in the order history.  I suggested a show or not show option for the product but they weren't too happy with that.  Any suggestions? 

 

Scaled down version of how it works now:

 

orders:

id

user_id

 

order_detail

id

order_id

product_id

product_price

 

 

Link to comment
https://forums.phpfreaks.com/topic/103044-db-design-when-ordering-items/
Share on other sites

A simple fix would be to populate a different table with order history details, the histroy table would contain something like -

 

History Line ID (autogen integer to define seperate lines as 1 order may have many products)

Customer ID

Order Number

Product ID

Purchase Date

Item

Description

Price

 

That way the contents of your product table would be irrelevant to the customer history.

Is that any help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.