Jump to content

Best way to store postage prices in database and link to products.


pepsi_max2k

Recommended Posts

Hey all, I very new to database design, trying to figure out how best to store some postage rates and link them to products.

 

Here's the data I want to stick in a database, it's inland postage rates from the Royal Mail (which change frequently so storing set postage costs is a no no):

http://www.royalmail.com/portal/rm/content1?catId=400030&mediaId=51000697

http://www.royalmail.com/portal/rm/content1?mediaId=50800722&catId=400029

http://www.royalmail.com/portal/rm/content1?mediaId=51000711&catId=400031

 

That's 3 different services, each with different size classes, each size class with different weigh classes, each with different prices. And I need some way of adding postage costs not covered by these too.

 

Here's my current design:

Postage
ID
Service Class               (First, Second, SP, Other)
Size                           (L, LL, P)
Max Weight Weight       (100, 250, 1000)
Price                          (0.40, 1.04)

Product
ID                                (0000001)
EAN                              (711719906520, 5055060923825)
Postage Weight Class      (100, 250, 1000)
Postage Size Class          (L, LL, P, SP)

 

I'm sure it's not perfect though. For any product, I just want to list a single second class service price, or if there is non (decided by weight) then first, and if non then standard parcels. Seems like it'll be a lot of work to sort that out. But if I just reference a single postage entry by ID then I can't go grab a first class cost for it too if needed. My head hurts :(

 

 

UPDATE:

 

Postage

ID

Type (L, LL, P, SP)

Class (First, Second)

Max Weight Weight (100, 250, 1000)

Price (0.40, 1.04)

 

Product

ID (0000001)

EAN (711719906520, 5055060923825)

Postage Type (L, LL, P, SP)

Postage Weight Class (100, 250, 1000)

 

Any product L, LLs or Ps can show 1st or 2nd prices. And SPs (standard parcels, no first/second avail) can only show SP prices. Not perfect, and deffinately not the way a human would look at the services, but a little better for the database methinks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.