Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4532452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:01:58+00:00 2026-05-21T14:01:58+00:00

I am developing online shopping cart system, I have items and item_options tables. Each

  • 0

I am developing online shopping cart system, I have items and item_options tables.

Each Item can have 1 or more options, see below.

items table

  • item_id (PK)
  • item_name
  • item_description

Note: item prices are in the item_options tables

item_options table

  • option_id (PK)
  • item_id (FK)
  • option_name
  • option_price

When the customer placed an order, the data will be added into the order and order_items table.

orders table

  • orders_id (PK)
  • customer_id (FK)
  • address_address_id (FK)
  • date_purchased
  • orders_status
  • orders_date_finished

order_items table

  • orders_items_id (PK)
  • orders_id (FK)
  • item_id (FK)
  • item_option_id (FK)

There is a problem, if the staffs change the price, item name or delete a item.. the customer invoices will be affected because the FK from the order_items will no longer be existed in the items table. What is the solution to this?

How about this solution: add active field in the items and item_options tables. When the staffs want to change the price or name of a item – just turn the current active record to 0 (items.active) and then insert a new record with the new information and active become 1. The old orders still point the correct id of the entry that is not active. Is this good way doing it?

When the new information has been inserted in the items table, does that mean I have to update/change the new PK ID in the item_id.item_options table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:01:58+00:00Added an answer on May 21, 2026 at 2:01 pm

    In something like this, I am definitely against the use of hard deletes. Every update or delete should be adding a new row into the item_options table and then marking the previous one as inactive (that way there is no chance that a user can select one of the previous values).

    Each new item inserted should consist of two steps:

    1. Add the item to the items table
    2. Using the item_id from the items table, add the item into the item_options table
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing online Shopping Cart system. Now I need to work on adding
I am developing online shopping system. Only UK customers can place an order from
I am developing online shopping system. This is how the product structure work: There
I am writing an online music store (wow!). I have written a shopping cart
I'm developing online examination system in php-mysql. That exam will consist of multiple-choice questions;
I'm developing an online website (using Django and Mysql). I have a Tests table
I'm developing an Online Judge System,like SGU http://acm.sgu.ru/ I wangt to obtain the accurate
I am currently developing an online Auction system using ASP.NET 3.5 and SQLServer 2008.
I have been developing a new online game for the past year now. The
I'm developing a web application which have a online forum with it. I'm going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.