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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.