views:

60

answers:

3

We have tons of products on our site. The vendors often raise the prices of their product line. If it is something easy like +10% we can easily make this change in the data base. But if the prices are changing chaotically; some up, some down with no common denominator. It can be a hassle keeping track that all the products pricing are up to date with the vendor.

So I was wondering if there is a common practice for this?

A: 

John,

it might be an idea to have the prices as a seperate date tracked table, i.e:

prices_xref(product_id, stt_date, end_date, price)

that way you could track the changes 'in time' if need be. of course, if this isn't possible, then another option would be to have a second table that reflected the 'last' prices and do a little compare on that and the live table and report on the differences (in an attempt to identify proces that hadn't yet changed).

of course; many ways to skin the cat :)

jim

jim
A: 

I'd change the structure of databse by having a price_modifier row there and making the price as some kind of "factory value" (standard value, which then is multiplied by price_modifier). So you just set the percentage (positive or negative) for item and when displaying the actual price on page, do the math for price.

Tom
+4  A: 

Ask your vendors to provide a web service that you can call to obtain all the latest product prices. You could then write a service that runs on a regular basis to update the latest prices to your database.

dretzlaff17
This is really the most appropriate option. For something like an e-commerce site, you don't want to hack anything together... ask the vendor if they provide an API of some sort.
alecwh
Many vendors won't provide a web service because they're living in the data processing dark ages, but most can provide a product feed that can be fetched and processed, frequently through FTP. Just be aware that no two vendor feeds are the same format, so you're almost certainly going to have to write custom code for each vendor.
Charles
@Charles, thank you, I was coming to post a comment asking what if the vendor won't provide a web service. Also what if they claim their prices aren't stored on a machine that can be accessed online?
John Isaacks
It depends. If they're a small vendor and they only have a few parts, that's understandable. On the other hand, if they're a large vendor and they don't have the ability to provide product data *somehow*, even if it's by mailing out spreadsheets, then I'd advise running far, far away from them if you can.
Charles
@Charles Thanks for the info, however, if the vendor's products are good enough sellers, we are at their mercy.
John Isaacks