SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    0 Post(s)
    0 Thread(s)

    Schema for Shopping Cart


    I am trying to develop a simple shopping cart in Ruby. I am running into some difficulties though on developing a proper database schema.

    All of the items that are purchased are virtual services. One example is that users should be able to purchase domains. This is what I'm having the most trouble with. I don't know whether to treat the TLD as a product in itself and the SLD as a customizable option of it, or whether to create a new product with the SLD and TLD when the user adds it to their cart. I'm leaning towards the latter because the TLD is technically not what is purchased, but the domain itself is.

    So for instance if I went with the latter option, I might have a table called domains with columns sld and tld_id, since I already have a table of available TLDs.

    If I were to go with the first option of treating the domain as a customizable TLD, I'm not quite sure how I'd do it. I'd probably have a customized_options table that referred back to the tlds table, and also to the order_items table since it needs to be customized for each order.

    I just don't really know the best way to go about this, and could really use some advice.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Toronto, Canada
    60 Post(s)
    3 Thread(s)
    go with the second one

    and don't use a numeric id to identify the tlds (as i'm guessing you were intending to do with tld_id) -- just use the tld code itself as the PK in the tlds table (and FK in your domains table) | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts