List price and Amazon sale price
| Project: | Amazon Module |
| Version: | 6.x-1.0-beta7 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Is there any reason why the module does not return the sale price, as offered by Amazon?
Almost every product on amazon has a "List Price" and a "Price". As of now I do get only the List Price of an item (the high price)
I've found that for products that do have an Amazon sale price, the XML returned by the Amazon API contains a section $xml->Offers->Offer->Merchant-MerchantID with a value of "ATVPDKIKX0DER" (which is the merchant ID for Amazon US) and another section $xml->Offers->Offer->OfferListing->Price which contains the sale price.
I've already patched the code to also return this reduced Amazon sale price. Are we not allowed to have the sale price on the Amazon items...?
I'm willing to share the patch if someone is interesting and adventurous enough to test it. The procedure requires to change the table schema of amazon_item table (to store the new price fields) and emptying the cache and amazon tables.
On my development site it works fine but I am curious for other installation setups.

#1
I'm adventurous... currently developing a site using this module and just put 'RRP' in front of the prices but would be good to get a 'live' price!
TIA
#2
I'd be interesed to have a look at it. I also need that offer price. Would you post the patch and tell me how you did it?
Concerning the legal issue:
I don't think there is a problem with publishing it, because it is not confidential information, nor information you have to buy, nor information they sell to earn money (talking about the price itself) and the citation is obvious. Moreover, Amazon could block this information being handed out, if they wished so, on the contrary they should be interested to let the commercially more efficient price too be used. My guess is that the programmers of the module simply forgot to implement it.
#3
Sure...
and sorry for the delay.
I've run a diff from my own svn repository where I develop my project. These are the changes I did on the 6.x-1.0-beta7 version of amazon module.
UPDATE:
You should also add the appropriate table fields to the amazon_item table. Run this with phpmyadmin:
ALTER TABLE `amazon_item` ADD `offeredpriceamount` FLOAT UNSIGNED NULL AFTER `listpriceformattedprice` ,ADD `offeredpricecurrencycode` VARCHAR( 32 ) NULL AFTER `offeredpriceamount` ,
ADD `offeredpriceformattedprice` VARCHAR( 32 ) NULL AFTER `offeredpricecurrencycode`
#4
Maybe we should also change the status, too...?
#5
Thanks for posting what you did code-wise. I've applied the changes to the code and the database tables, and run update.php but I'm not getting any offer price data. A few rows of my table have a '0' in the 'offeredpriceamount' field but nothing else.
Am I missing something I need to do?
#6
Hmmm... ignore that a bit - found it's filled in values for 5 rows of amazon_item table with the offer prices (I have 12,556 rows...)
Will keep playing...
#7
Don't forget that the amazon module is caching it's requests... Maybe you have to clean them up to force them to re-download.
Actually purging all the cache tables would hurt (a lot ;-)
#8
Well, I get the offered price for all newly entered content. Which confirms your suggention that one still has to force to re-download the information from amazon.
However, on the node, I get the following error message:
user warning: Unknown column 'offeredpriceamount' in 'field list' query: INSERT INTO amazon_item (asin, title, detailpageurl, salesrank, brand, publisher, manufacturer, mpn, studio, label, binding, releasedate, listpriceamount, listpricecurrencycode, listpriceformattedprice, offeredpriceamount, offeredpricecurrencycode, offeredpriceformattedprice, productgroup, producttypename, timestamp) VALUES (...,...,...) in C:\xampp\htdocs\...\includes\common.inc on line 3468.
Furthermore, if I want all information to be up to date I would have to re-download the information regularly, right? How do I do that?
#9
Yes, I'm getting more data now so seems to be ok.
Re the error - have you added the fields to your table? (details in the patch for the install file, I just manually added them through phpmyadmin using the 'insert a field after...' to get them in the right place).
#10
Hi stratosgear
I must be missing something. Your patch, the way i have it, is reverting from your revision 77 to 14 and removing the lines referring to the "Offered Price" instead of adding them. Is this the correct version ?
#11
How embarrassing...
I posted a reverse patch. I blame eclipse for using by default this patch direction when comparing between two revisions :)
Clicking "Swap From and To" when running the comparison produces a correct patch.
Thanks poloparis...
#12
@stratosgear:
You will need hook_update_n to update the db to add your stuff into it.
Also, please post patches in a .patch file. It helps to read them if you also use the -up format (if from cvs or diff command) which helps us understand the patch when just reading it.
I suspect that you'll also have to add a configuration option for the list vs sale price. Both are useful data items. The easiest way to deal with all of this is to use views, and to add the list and sale prices into the views API.
#13
I need to mention a couple of issues to you if you're interested in pursuing this:
1. Amazon.com is not the only seller reported by a query, so there are often many prices returned. Thus, if you want Amazon.com's price, you will have to specify the seller as being Amazon.com. Then you will have to go through the Offers and find Amazon.com's offer.
2. If you're going to do this, I think we probably need a configuration item that says "Use Amazon.com seller prices" that would control it.
#14
And I should have mentioned earlier: The Amazon Store module has fairly robust handling for this sort of thing. It gets all the offers and presents all the sellers. So it might be a better match for what you're doing.