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.
Comment | File | Size | Author |
---|---|---|---|
#25 | amazon.remove_mistaken_debug_code.patch | 612 bytes | rfay |
#24 | amazon.currency_code_update.patch | 731 bytes | rfay |
#23 | amazon.new_fields_and_reviews.patch | 24.38 KB | rfay |
#11 | patch.txt | 4.92 KB | stratosgear |
#3 | amazon.patch | 4.92 KB | stratosgear |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI'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
Comment #2
papricus CreditAttribution: papricus commentedI'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.
Comment #3
stratosgear CreditAttribution: stratosgear commentedSure...
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:
Comment #4
stratosgear CreditAttribution: stratosgear commentedMaybe we should also change the status, too...?
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks 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?
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedHmmm... 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...
Comment #7
stratosgear CreditAttribution: stratosgear commentedDon'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 ;-)
Comment #8
papricus CreditAttribution: papricus commentedWell, 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?
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedYes, 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).
Comment #10
poloparis CreditAttribution: poloparis commentedHi 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 ?
Comment #11
stratosgear CreditAttribution: stratosgear commentedHow 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...
Comment #12
rfay@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.
Comment #13
rfayI 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.
Comment #14
rfayAnd 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.
Comment #15
rfayI think adding the db entry for current amazon price (or perhaps lowest price) is a valid thing to do. Several people have requested it.
Comment #16
antlib CreditAttribution: antlib commentedThat would be a very welcome addition (and top of my secret wish list).
Thank you for all your hard work on this module - really appreciate your patience and perseverance!
Comment #17
rfayComment #18
BillMounce CreditAttribution: BillMounce commentedCan you tell what the actual name of the filter is? Amazon price: [amazon 0000000000 amazonsaleprice] ?
Comment #19
rfayThis is a feature request. There is no support for the lowest price of Amazon price at this time.
You may be interested in the Amazon Store module, which provides the available prices.
Comment #20
BillMounce CreditAttribution: BillMounce commentedSorry. I thought that was the point in a previous post, that the info was now available. I will post it in the feature requests. --Bill
Comment #21
jhack31 CreditAttribution: jhack31 commentedI have installed both the amazon module and the amazon store module, and I don't think that either one provides the functionality for which I am looking.
I am trying to create a book buyback site, where an anonymous user can enter an ASIN and get a price quote back. The price quote needs to be a certain percentage of the used book offer from the amazon store.
Does anybody have suggestions for me?
Thanks very much.
Comment #22
rfayThe information is there in the Amazon Store cache. You can get the Amazon item and traverse it (in SimpleXML) to find what you want. It's not too hard.
However, if I were you I think I'd write custom code for this, since it's a very narrow, specific application. Probably a patch for this module would be the thing to do. It does require a database change.
Probably when we do this we should get and save both the lowest price and the Amazon price.
Comment #23
rfayOK, I did this.
The lowest price and Amazon's lowest price are now available in the database, in views, and as filters.
This also includes #609448: Feature: Add customer reviews and ratings to Amazon information retrieved.
Committed: http://drupal.org/cvs?commit=333428
This will be in tonight's dev release. Please try it out and see if it meets your needs.
Comment #24
rfayFollowup: in hook_update_N() I messed up the type of the currency code. This patch should fix that even if the previous one got installed.
Committed to DRUPAL-6--1: http://drupal.org/cvs?commit=333854
Comment #25
rfayOops - left in some debug code.
Committed to DRUPAL-6--1
http://drupal.org/cvs?commit=335358
Comment #26
rfayA user reported by email that this didn't work in views.
Comment #27
rfayThis seems to work. Please reopen if you have difficulty with it.
Comment #28
hoZt CreditAttribution: hoZt commentedThere are still some prices that are not showing up. If the item has variations with different prices then all the prices returned will be null. If we are able to add the Response Group VariationSummary then prices are correctly returned. A good ASIN to look at is: B00139CD4S
Here is a link to amazon description of the variationsummary api.
I do not think it would be necessary to add more fields for the cache just use these for the prices when they are returned.
Here is what is returned when VariationSummary is added:
Comment #29
rfayVariations are a lot of pain - I did them in Amazon Store. Lot of pain.
How would you choose which variation to select the price from?
If you want variation handling, please think of how you'd like to do it and open an issue for variations. Patches are welcome. Remember that each variation has a different ASIN. So that has to be handled.
Comment #30
sk33lz CreditAttribution: sk33lz commentedI recently was having this issue, and found this thread. I updated to the latest dev version after this patch was committed and I now have several other fields including the Amazon price and Lowest price available in my views. I am just having my view hide the field if it is empty, which will just show the list price. Great stuff!