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

  • Home
  • SEARCH
  • 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 7920025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:04:06+00:00 2026-06-03T16:04:06+00:00

I have a site that provides an e-commerce service, basically allowing sellers in the

  • 0

I have a site that provides an e-commerce service, basically allowing sellers in the industry to place their products up for sale to clients. Sellers select the products they wish to sell and set the price. They are then hands off.

In a simplified form, I have the following relevant tables in my database for storing product and order information:

Product_Info
--------------------
ID (autonumber)
name
...


Order_Head
--------------------
ID (autonumber)
CustomerID
...


Order_Line
--------------------
ID (autonumber)
OrderHeadID
ProductID
...

This works great for simplified orders where customers choose any number of products and add them to their cart. However, I’m now faced with the problem of adding seller created and managed ‘packages’, wherein sellers can group multiple products together into a single item and sell it at a lower price than the individual items would cost together. For instance, if oranges costs $15 and apples costs $20, a package containing 2 oranges and 1 apple may only cost $35.

The twist, and the part that has me stymied right now, is that I would very much like packages to be able to contain other packages. For example, a seller could make an “assorted oranges” package containing 3 oranges. They could then make an “assorted fruit” package that contains 2 apples and 1 “assorted oranges”.

How to manage that is confusing me both from how to list the products within a package when I could be referencing an ID from either the product table or from the package table, and from how to record the products in the order_line table since the productID could be pointing to either a product or to a package. And, of course, this needs to be designed in an efficient manner so we’re not taxing the database server unneccessarily.

I’m primarily a web developer and haven’t done much with e-commerce before. Could anyone offer some direction as to an appropriate set of tables and table modifications to apply to the database? I don’t know why, as it doesn’t seem like it should be that complicated, but this one has me stuck.

For reference I’m using MySQL 5.1, connected to ColdFusion MX 7 (soon to be 9).

EDIT:

Thank you for the responses so far. I will take a little time to think on them further. In the mean time I wanted to clarify how the order process works since it appears to be more relevant than I may have originally assumed.

My product works similar to Shutterfly. Photographers post photos, and clients may purchase prints. The photographers need tools to set all the pricing, and will often offer packages if it is from a professional shoot. Fulfillment is done by a lab that my product submits orders to automatically, but they have no knowledge of pricing, packages, etc.

Photographers also have the option of running specials to provide clients with x% off or BOGO deals, but I can handle that separately. For right now I’m more concerned about an efficient and simple way to store the photographer defined packages, the client’s image selection for each product in the package as they shop (currently stored in a order_line mirror table), and the eventual order details, so that they can be queried for display and reporting quickly and easily.

  • 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-06-03T16:04:08+00:00Added an answer on June 3, 2026 at 4:04 pm

    Create an additional table which lists the items which are members of each package, and the quantity included in a package.

    Table Package_Items

    CREATE TABLE Package_Items (
      package_id INT NOT NULL 
      item_id INT NOT NULL,
      item_quantity INT NOT NULL DEFAULT 1,
      FOREIGN KEY (package_id) REFERENCES Product_Info (ID),
      FOREIGN KEY (item_id) REFERENCES Product_Info (ID)
      PRIMARY KEY (package_id, item_id)
    );
    

    The package_id column references the row in Product_Info which is the main package item. item_id refers to other items which are package members. There can be multiple package_id, item_id combinations.

    Using this method, you can create new rows in Product_Info which represent packages. All that needs to be done to add items to the package is to add corresponding rows in Package_Items. If a row added to Package_Items happens also to be a package product itself, no extra work needs to be done.

    Just take care not to add a package to itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my issue. I have a site that provides some investing services, I pay
I have a site that provides images for the internet, and I have Google
Hi, I have a site that provides two versions for browsers and mobiles. I
I have a site build on rails that provides XML version of all relevant
I have a friend experiencing problems testing a web site of mine that provides
I have a site that i want to redirect all requests accept for 1
I have a site that allows download or streaming of mp3 files. All the
I have a site that can be accessed both through http (http://mysite.com) and https
I have a site that has an Rss feed, and this feed is consumed
I have a site that can allow me to access the mobile version of

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.