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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

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

papricus’s picture

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.

stratosgear’s picture

Status: Needs review » Active
FileSize
4.92 KB

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` 
stratosgear’s picture

Status: Active » Needs review

Maybe we should also change the status, too...?

Anonymous’s picture

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?

Anonymous’s picture

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...

stratosgear’s picture

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 ;-)

papricus’s picture

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?

Anonymous’s picture

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).

poloparis’s picture

Status: Active » Needs review

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 ?

stratosgear’s picture

FileSize
4.92 KB

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...

rfay’s picture

Status: Needs review » Needs work

@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.

rfay’s picture

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.

rfay’s picture

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.

rfay’s picture

Status: Needs work » Active

I think adding the db entry for current amazon price (or perhaps lowest price) is a valid thing to do. Several people have requested it.

antlib’s picture

That 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!

rfay’s picture

Title: List price and Amazon sale price » Provide Amazon.com price or lowest price or both
Version: 6.x-1.0-beta7 » 6.x-1.x-dev
BillMounce’s picture

Can you tell what the actual name of the filter is? Amazon price: [amazon 0000000000 amazonsaleprice] ?

rfay’s picture

This 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.

BillMounce’s picture

Sorry. 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

jhack31’s picture

I 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.

rfay’s picture

The 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.

rfay’s picture

Status: Active » Fixed
FileSize
24.38 KB

OK, 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.

rfay’s picture

Followup: 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

rfay’s picture

Oops - left in some debug code.

Committed to DRUPAL-6--1
http://drupal.org/cvs?commit=335358

rfay’s picture

Status: Fixed » Active

A user reported by email that this didn't work in views.

rfay’s picture

Status: Active » Fixed

This seems to work. Please reopen if you have difficulty with it.

hoZt’s picture

Status: Fixed » Needs review

There 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:

 [VariationSummary] => SimpleXMLElement Object
        (
            [LowestPrice] => SimpleXMLElement Object
                (
                    [Amount] => 19500
                    [CurrencyCode] => USD
                    [FormattedPrice] => $195.00
                )
 
            [HighestPrice] => SimpleXMLElement Object
                (
                    [Amount] => 19500
                    [CurrencyCode] => USD
                    [FormattedPrice] => $195.00
                )
 
            [LowestSalePrice] => SimpleXMLElement Object
                (
                    [Amount] => 14900
                    [CurrencyCode] => USD
                    [FormattedPrice] => $149.00
                )
 
            [HighestSalePrice] => SimpleXMLElement Object
                (
                    [Amount] => 14900
                    [CurrencyCode] => USD
                    [FormattedPrice] => $149.00
                ) 
        )

rfay’s picture

Status: Needs review » Fixed

Variations 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.

sk33lz’s picture

I 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!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.