Re: Design Problem: Products Pricing Affected by Optional Extras




"ijoxley" <ijoxley@xxxxxxxxxxxxxx> wrote in message
news:1192447983.340390.137010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am struggling to come up with a design for a products database and
would appreciate any help.

The client has a number of products, each with different options: the
problem is that the product's price

is affected by which options and in some cases the combination of
options.

For example, a product can have the following attributes:

code
handing (left-handed, right-handed or both)
width
length
height
glass options
frame options

Some products do not have any options, some have a different price
depending on the frame selected, and

others have a different price depending on the frame and colour
selected e.g. Product A with a silver frame costs £600.00, with a
white frame costs £700.00, but with a white frame and blue glass costs
£750.00.

So far I have come up with a table structure something like this:

CREATE TABLE products (
code char(10) primary key,
name varchar(20) not null,
width int not null,
length int default 0,
height int default 0,
notes varchar(255),
price decimal (7, 2)
)

CREATE TABLE glass_options (
code char(10) NOT NULL,
colour char(10) NOT NULL,
notes varchar(255)
PRIMARY KEY (code, colour)
FOREIGN KEY (code) REFERENCES products.code ON DELETE CASCADE ON
UPDATE CASCADE
)

CREATE TABLE frame_options (
0code char(10) NOT NULL,
colour char(10) NOT NULL,
notes varchar(255),
price decimal (7, 2) NOT NULL
PRIMARY KEY (code, colour)
FOREIGN KEY (code) REFERENCES products.code ON DELETE CASCADE ON
UPDATE CASCADE
)

Each product can have 0 or more glass options.
Each product can have 0 or more frame options.


The fact that price is in both the products table and the
frame_options table worries me as it seems less than ideal, but if a
product has neither glass or frame options then it still needs a price
so I cannot think of another way around this at the moment. I was
thinking of removing the relationship between glass_options and
products and instead making glass_options related to frame_options,
but then that could introduce a third price attribute in the
glass_options table which just does not seem right either.

Any help here would be much appreciated.

Response:

Do these products have a Universal Product Code (UPC)? If they do, can
one product with one UPC carry multiple prices depending on glass and
frame options, or does each unique configuration get its own UPC?

If the answer is the latter, one design might be to include a separate row
in the product table for each UPC, and put the price in the product table,
as you might do with any other product table. You then might need some kind
of table of what I'll call "product groups" that has one entry for each
product, as your current product table does.




.



Relevant Pages

  • Design Problem: Products Pricing Affected by Optional Extras
    ... frame options ... Some products do not have any options, some have a different price ... PRIMARY KEY ... UPDATE CASCADE ...
    (comp.databases)
  • Re: Sony A100 to A700
    ... Perhaps I'm optimistic about the $1000 price for a full frame body this fall, but it is just a matter of time before the entry level models come out with it. ... The Sony a900 and Nikon D3x are 99% certainty in name and in sensor configuration. ... I guess I'm underwhelmed by the concept of Fx - particularly high resolution Fx - unless it also comes with the feature set that helps to get the shot. ...
    (rec.photo.digital)
  • Re: Sony A100 to A700
    ... Perhaps I'm optimistic about the $1000 price for a full frame body this fall, but it is just a matter of time before the entry level models come out with it. ... The Sony a900 and Nikon D3x are 99% certainty in name and in sensor configuration. ... I guess it could be the lowest price full-frame dslr, but it either isn't going to be 20+mp, or it isn't going to be featured to compete with the pro-level cameras. ...
    (rec.photo.digital)
  • Re: Trials Frame Design Help
    ... piss poor wages on production machinery. ... Before you go talk about price, ... Not because you can't sell it, you certainly can, but there's no ... I wish I would've measured when I welded that one frame back together. ...
    (rec.sport.unicycling)
  • Re: WTB: Old Steel Frame 52 - 54 cm
    ... hubs on GP4 tubs, Galli calipers, Ultegra cranks, 1" quill stem, etc. ... If you just want the frame, you can have it for $150. ... Paul Hobson Wrote: ... I'll be glad to talk to you about a more appropriate price. ...
    (rec.bicycles.marketplace)