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 7589801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:15:02+00:00 2026-05-30T20:15:02+00:00

I’ve worked with a dozen or so template systems (Zen Cart, Cube Cart, etc.).

  • 0

I’ve worked with a dozen or so template systems (Zen Cart, Cube Cart, etc.). Each of these has their own bizarre way of structuring products, options and categories. All the add-on features result in a McGuyver’d stack of cards situation that makes working with the code a total drag.

So six years ago I built my own webstore engine, which has evolved over the years and become its own stack of cards. Now I’m doing a total overhaul on the engine. While no one engine will suit all webstore needs, I was wondering if the following model has any drawbacks, or if there’s a better way to create a flexible, normalized, non-obnoxious database for commerce:

enter image description here

Notes:
option_types = colors, sizes, materials
options = red, white, blue, S, M, L, cotton, spandex, leather

Other than basic stuff omitted on purpose (position, active, etc.), anyone see a way to improve this?

  • 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-30T20:15:04+00:00Added an answer on May 30, 2026 at 8:15 pm

    Here are my notes/opinions on this. You’re missing cardinalities, but I’ll do my best to guess them.

    • Categories is ok.

    • Remove id from item_categories as you’re not using it. Create a composite primary key on category_id and item_id.

    giving each record a unique id is smarter in many ways: faster to look-up on one field than on two, safer to delete, etc

    What lookup would you do on that id? The queries you’ll run are: “Getting all categories for an item” and “Getting all items for a category”. I don’t understand why it would be safer to delete. However, I’d say adding an id might be unsafer to insert as you might have different ids but same category_id and item_id pairs. You’ll have to check the constraints there and make sure the pairs are unique (and aren’t that what PKs are used to?)

    • items is ok… (see comments below)
    • Remove id from item_options (same case as above and see comments below)
    • option_types is ok

    Now, I think the way items and options are related will require more thinking. It seems to be a many-to-many relationship. As an item, such as a T-Shirt can have many sizes it makes sense to say that each pair items and options should have a different size. But what happens when, apart from the size you also have a different material, such as cotton and leather. You will have to have information on the pairs cotton-S, cotton-M, cotton-L and leather-S, leather-M and leather-L. This makes sense as I’m pretty sure all of them will have a different price and weight. But now let’s add 2 colors to our T-Shirts. You’ll have to add a price and weight for each of the 12 combinations we’ll have now.

    Not to mention that if a user would like to see the price of an item he’ll have to choose all the options until he reaches a price. I’m not sure how this should be done as I’m not aware of the requiremets. I’m just throwing an idea: you could apply prices and weight variations over a base price and weight that would be part of the item.

    Just some unprocessed thoughts before going to sleep:

    • option_types could be some kind of hierarchy
    • Carefully think of how you would handle stock given that design. You’ll have 10 items for a Black T-Shirt… but how many items will you have for a Black Leather T-Shirt? How is that number related to the 10 original ones?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string

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.