So, I have an e-commerce site. This site has items, which in turn have attachments, pricing, and a order form etc.
I’m looking for approaches to handle changes in pricing, forms etc. If a pricing structure changes, it’s reflected for new orders no problems, but how do I keep the order history intact?
E.g pricing options are pre-set like following, and I store the pricing ID on the order:
100 - $150
200 - $280
If a user updates the pricing in the back-end, the order history will show incorrect pricing
Seems to be an approach of keep the original pricing somehow in a legacy table? Or just dump hard copy values for these things?
Any advice would be appreciated.
When the pricing is updated, the original values should be appended to a price history table that shows the price, the date range during which it was valid, and a Foreign Key to the item.
This is a normalized approach; it doesn’t involve copying data. It may take a little extra design/coding up front, but consider it a gift to yourself (and your team) in the future. You will be able to query for an accurate history of price changes as well as order data at any time.