Thanks for visiting! This is the weblog of Lynda, a 26 year old girl living in Atlanta with her husband, three cats and two cockatiels.
| Home | Journal | Photos | Contact |
The ASIN is the same as an ISBN for books. Amazon calls all their product IDs ASINs. The ASIN is available on the amazon product page.
Very nice work! Thanks a lot!
(Now I only have to figure out how to use it with Amazon Germany - AmazonSearch is querying Amazon US only, so no results are found for most german books.)
-ms
Markus, to use it with Amazon Germany, try this.
Open AmazonSearch.php and find this line:
define(’WSDL_FILE’, ‘http://soap.amazon.com/schemas2/AmazonWebServices.wsdl’);
change the URL in there to this:
http://soap-eu.amazon.com/schemas3/AmazonWebServices.wsdl
Then in pi.amazon.php find this line:
$amazon_link = “http://www.amazon.com/exec/obidos/ASIN/” . $amz_asin . “/” . $associate_id . “/ref=nosim/”;
And try changing the .com to .de
I have *absolutely* no clue if that will work, but it’s a start.
I got it running on my book review blog
http://books.blinger.org
Just a note when adding ISBN numbers do not put the dashes, it will break the page
0-13-041392-5 is bad
0130413925 is good
Thanks, Lynda.
Good starting advice. Checked that already but it seems I have to hack AmazonSearch.php even more. From the API docs:
“Amazon Web Services uses the US Web site as the default site for shopping and fulfillment. To target a request for a specific country, you need to both append a parameter to the call to identify the country in question, and (for UK and DE), use a slightly different URL in making your calls...”
and
“Users of international AWS should be aware that product mode parameters vary slightly on a country-by-country basis, and that a service call will not work if an incorrect mode is used...”
I’ll try to figure out the details as soon as possible and keep you informed.
Best regards
Markus
Keep in mind you’re using Amazon’s ASIN, not the ISBN. Yes, they are the same number, but Amazon’s ASIN does not have dashes and is just a number.
I’ll see about adding functionality to strip dashes if that would be easier. It’s not difficult to add.
How would I make a booklist uisng this?
Should I create another ‘book blog’, much in the similiar way that LisaJill has showed us how to do with her BlogRoll tutorial?
Or should I wait until someone writes an acompanying (sp?) plugin for a bookqueue?
I’m not sure what a “bookqueue” is. Could you define that for me?
It depends on how you want to use this. You can assign the ASIN directly in the code, so you don’t technically need to use this inside the weblog:entries tag and you can also use it more than once, so you could do:
{exp:amazon:asin}
{define_asin}ASIN1{/define_asin}
other desired code here
{/exp:amazon:asin}
{exp:amazon:asin}
{define_asin}ASIN2{/define_asin}
other desired code here
{/exp:amazon:asin}
Just so you know… I was at working using IE and your site is broken. I know it looks fine in firefox, but not IE
The mt bookqueue plugin that I grew to love so much was a little app that integrated with the Amazon API.
It keep a running list of the books one had read, was reading, and was planning to read.
Using it’s own calls, you could decide to show, say 10 of the latest books.
The latest revision 1.1 is out. Localization preferences were added per Markus’s request and help. Per The Linguist’s recommendation, dashes are now stripped from the ASIN so you can copy straight from an ISBN if you need to.
I’d suggest subscribing to comments if you’d like to be notified of future updates.
thankyou for the update, lynda! i much prefer to use amazon UK for it because the book covers are generally the same as they are here but the US ones are often different.
This plugin has been updated to version 1.2 to include keyword and similarity searches. In addition, the associate id and dev token are now called from an external config.php file.
Lynda - A few comments up, I noticed you told Markus to change a line to get it working with Germany - would the same hold true if I wanted it to work with amazon.ca?
I forgot about canada. I’ll make an option for Canadian localizations as well. It probably won’t be until tomorrow though. In the meantime, you can try exchanging the amazon.coms for amazon.cas in the pi.amazon.php and see if that works. I’m not sure, but I think the WSDL (or is it WDSL? can’t ever remember) file points to the same location for both us and ca.
First of all, thanks so much for making this awesome plugin available for everyone! It rocks!!
I am implementing it on one of my sites right now, but I think I have discovered an issue with the category and locale parameters. This works fine:
{exp:amazon:keyword category="dvd" limit="3"}
The below works too, except that it only shows books, it seems to be completely ignoring the category parameter:
{exp:amazon:keyword category="dvd" limit="3" locale="uk"}
I have tried switching the parameters around, but I haven’t gotten it to work yet. I have tested this with “de” and “jp” as well, and with “de”, the same thing happens, it only shows books. The “jp” one however, does work properly and shows DVDs.
I suspect that this is a small bug, so I just thought I’d let you know.
Thanks again for all your hard work!
Thanks for letting me know about this. I remember something being set to default for de and uk (it uses a different file to tap into the api) but I thought I removed it.
Babs, I’m not sure that Canada is supported with Amazon Web Services. Their site states: “Both of these methods return structured data (product name, manufacturer, price, etc.) about top-selling products at Amazon.com (US), Amazon.co.uk (United Kingdom), Amazon.de (Germany), or Amazon.co.jp (Japan) based on parameters such as keyword search terms and browse nodes.”
Could you tell me if changing the amazon.coms to amazon.cas work the way you would expect it to? If so, I can make it another preference.
Hi Sasha, I found the problem was that I didn’t give instructions for which category to use. Please see the newly added reference section above for the correct text to place in the category parameter.
Thanks Lynda, it’s working perfectly for the UK locale now! (if you want to see it in action, surf to fever-of-fate.com and look in the wallpaper and scan sections) :D
A big “thank you” from me as well, especially the added the keyword and similarity search capabilities rock
The reference section is extremly useful, too!
Can some of you that have implemented this, give examples of the code you used, your setup, and possibly an example website?
Thanks everyone.
Here’s the coding I’m using.
This code is placed at the total bottom of the template that I’m using to show only single entries. To see it in action, look here, or here, for example. Hope that helps you!
{exp:weblog:entries weblog="scans" limit="1"}<h3 class="shoph3">More {title} ...</h3>
<div class="shop">
<table border="0"><tr>
{exp:amazon:keyword locale="uk" category="dvd-uk" limit="4"}
{define_keywords}{title}{/define_keywords}
<td class="centersmall" width="25%" valign="top">
{if img_small_width > 5 }<img src="{img_small}" alt="{product_name}" {img_small_size} border="0" />{/if}<br />
<a href="{amazon_link}" target="_blank">{exp:word_limit total="8"}{product_name}{/exp:word_limit}</a>
</td>
{/exp:amazon:keyword}
</tr></table></div>{/exp:weblog:entries}
So it looks like you set up a separate blog for the book entries.
Did you then define a custom field group / custom field for the ISBN (ASIN)?
...thus making every ‘post’ to the book blog a book/cd/dvd entry?
Jake,
That’s exactly what I did here, though there are only two reviews so far and I haven’t updated to the newest version of the plug-in yet.
Lynda, I changed the .com to .ca in pi.amazon.php and everything still works. Would you recommend changing it in the other files as well? Basically what I’d like to do is pull the canadian price of the items vs. the american prices. :crossfingers:
Hey Babs. Amazon hasn’t released an API for Canada yet, so there’s no way to pull in Canadian prices yet. They say Canada and France are coming soon.
I keep having issues. well. with the plugin. not me personally. anyway. If I add and ASIN number for a CD that doesn’t have cover art, My blog returns {if img_small_width > 5}{/if}
I was having the same problem is I posted an entry that did not contain an ASIN - would just show me the container tags. I fixed the ASIN issue with an if statement - if asin is empty show this if has content show something else.
But I’m not sure how to build the same kind of fix for images.
Hey Babs, the problem wasn’t what I thought it was.
I tested this on a couple of ASINs that had no cover art and it actually worked the way it was supposed to.. The only way I would think it wouldn’t work is if NO image is returned.... (amazon is supposed to return an image regardless)
Could you try plugging an: {if image_small) {/if} around the whole thing and see if that works? Could you give me a couple of examples of ASINs this is happening to in order to test it to see if it’s something I can replicate?
Also, for your ASIN problem, do you mean if the ASIN wasn’t assigned you’d get the define_asin container tags, or you’d get them all? If it’s the former, I think that’s something I can fix on my end.
I just realized that I had changed all the .coms to .cas I’m going to put them back to .com and see if that’ll fix it before trying anything else.
Example ASIN that I’m having a problem with: B00006L5LT, B000024M7J.
I’ve put it back on my site so that you can see the result. It also makes the {if img_small_width > 5}{/if} code appear on a completly unrelated entry.
I’m not sure what you mean by “plugging an: {if image_small) {/if} around the whole thing” I’ve got his as my code now which seems to be what you’re asking me to do.
{if img_small_width > 5}{if img_small_height > 5}
{/if}{/if}
As far as the ASIN issue - if I do not assign an ASIN - I get the Define asin container tags. I’ve fixed this on my side by only including the tags if that field is not empty
{if media_asin != “"}
{define_asin}{media_asin}{/define_asin}
{/if}
Hey Babs. It looks like the problem is those products are only available in Canada, not the US. According to the Amazon API documentation, an API doesn’t currently exist for Canada. I’ll do some more research to see if there’s anything out there for Canada yet.
The only .com that needs to be changed to .ca is in the pi.amazon.php file. You might be getting strange results if you changed the WSDL in the AmazonSearch.php file .ca.
It should actually be returning NOTHING at all for these ASINs (that’s what it does for me)
Unfortunately, there’s no way I can make it work for Canada until Amazon releases an API for Amazon Canada.
that’s awesome thanks for confirming that.
any reason however that {if img_small_width > 5}{/if} also shows up in the unrelated entry when a canadian only ASIN is put in an entry?
media page is currently showing this behaviour.
I have absolutely no idea why it’s doing that for Canada and not US. It’s probably returning some weird things if you’re trying to use an API that isn’t fully developed.
Got this work perfectly. Thanks for all your hard work.
One question though:
Is there any way you could set the plugin to cache it’s database calls? What if the amazon server is down or not responding? I know you could cache the page from a php / EE perspective, but I think having the amazon db calls cached would be really cool as well.
Cheers,
Jake
I’m sure there’s some way to do this, but I don’t know too much about caching. The image wouldn’t be able to be pulled to your server though. If the amazon server is down, the information simply won’t show up on your site.
As for Bab’s problem - you’re using Canadian ASINs. At least that was the case with the couple ASINs you sent me the other day. If you try to plug the canadian ASIN into the US version, you get nothing at all. They probably have some weird stuff in their api for the ASIN which is why you’re getting weird results. I would suggest finding the ASIN on the US site and using that one instead of finding the ASIN on the Canadian site.
I’m not sure Amazon sends the book description through the API - they do send reviews, but I didn’t bother with that. I’ll look into it when I get a chance, but I don’t think they provide it.
Ok. Thanks for your help.
For others out there, as another example of this set up, you can visit my booklist here:
Lynda, out of curiosity, how did you get the ratings images? Just pre-defining the ratings categories, and then assigning star images to each of them?
Awesome plugin Lynda. I wish I understood PHP enough to write plugins like this.
One request/wish:
I also would love to see it cache the database calls. Maybe Paul or Rick would be able to help with this?
Thanks again I’m loving the plugin.
I will definitely look into caching, but I’m not sure when I’ll get around to it. It shouldn’t be too difficult to cache the info returned from the API, but I know nothing about caching. I should be able to figure it out by looking into how it’s currently done in EE. Still, I just don’t know when I’ll get a chance to fiddle with it. But I WILL be fiddling with it at some point.
Terrific - thanks for this. Now I must try to come up with something useful myself for the EE community.
Hi,
Implemented your plugin. All seems to be working well but when I click on any of the monthly archives I get this
{if amazon_price}Price:
{/if} {if release_date}Release Date:
{/if}
on the left side of the entry.
It only happens of the monthly archive links...not on the index page, category pages or the pagination entry archives.
Do you have any ideas?
Thank you,
Martie
my weblog is at www.martiegras.com/blog/
Also here is an example of one of the monthly archives page.
Oh, I see what’s going on. I’m still not sure what might be causing it. Hmmm. Are you using any other sorts of PHP or plugins on your archives, category pages/etc? If you turn on debugging to display for everyone, do you get any errors?
As far as the archives and category pages I am not using any PHP or plugins. In my index page I am using PHP for
Private entries, random quotes, and for copyright. For plugins I am only using this amazon one.
I turned on debugging and as far as I can tell it gave me no errors. I don’t know......
Lynda, Every so often I get this error message (instead of my journal loading)
Warning: Invalid argument supplied for foreach() in /home/babineau/public_html/journal/sys/plugins/amazon/nusoap.php on line 5489
Fatal error: Call to undefined function: asinsearchrequest() in /home/babineau/public_html/journal/sys/plugins/amazon/AmazonSearch.php on line 108
It’s always the same lines and the same errors. Do you know what this might be?
Hello,
my englisch ist not very good, but i will try.
I downloaded your class, but i don’t know how to get it to work.
This is the first time i will work with classes.
Please give a litte example, how i include the class in a php file.
Thank you very much.
Nico Sprenger
Just found out, that for german users, there is category “books-de-intl-us” for finding international books in english to.
Is there any possibility to configure multiple categorys, because if i don’t select any category i have no result in intl-us books.
I just was reading a little bit about possibilities and i think it would be great to have a blended search option.
Hi Lynda
Amazon Plugin is great. But, as you perhaps allready have seen in pmachine forum, it extremely slows down the site. Page render times going up from 0.3 seconds to up to 8 seconds. i can see on your site that it is similar to mine from speed and even sometimes i had blank pages.
do you think about adding some caching preferences for the amazon api?
regards
Christian
I’d love to be able to cache, but unfortunately I am not familiar enough with the caching process to do it for the amazon plugin. I’ve tried, but I just end up lost.
I have a lot going on in my pages which results in high load times. The amazon information from the plugin really doesn’t increase the load time for my site by more than a fraction of a second.
Do you need help finding / engaging some people that might be able to assist in the cache’ing problem?
Well, I figured out the blank pages are caused by nusoap.php, but I haven’t been able to find a solution for it. WordPress’ Amazon plugin experiences a similar thing. I’m going to investigate alternate methods to access Amazon’s API and will try to rebuild the plugin completely - hopefully including some sort of caching option. No idea how soon that will be though.
Hey, first of all, i could get better performance with tag caching from expression engine. Try it. Also i included a blended functionality, are you interessted in this? perhaps you could include it in a other version. it’s not perfect, but it finds the book i want to display from de-books-int.
I’ve recently upgraded to PHP5 and it breaks this pluggin. Have you had a chance to take a look at this?
Nope. I have no desire to install PHP on my home machine and my server hasn’t upgraded yet (and I hope doesn’t soon because there’s nothing worse than upgrading to a new version of PHP as soon as it comes out) For now, I guess it just doesn’t work in php 5.
I’m surprised you don’t have a development environment.
Can you at least put in a notice, lettting people know that the current version is not PHP5.0 compatible?
Lynda,
I tried using the author tag {amz_authors} but that doesn’t seem to work with CD’s or music.
Is there any way to add a tag for Artist? (for music/CD’s)
I agree - would be super-rad to have music-specific tags. It would also be really cool if it were possible to syndicate lists automatically using the affiliate tags - specifically wish lists…
Thanks so much for the plugin - it’s awesome!!
Matthew
Lynda...
----------
Just getting into this and have a couple of questions
1) Am testing with products from the “Home Improvement” category, is pulling down the retail price but not the Amazon price even though both are shown at Amazon. Are some of these tags only good for certain categories?
2) Is the plugin only good for the tags you list “amazon_price”, etc. or can a person get other data like how many are in stock and expected delivery?
----------
Have a manufacturing client that sells a lot of various items to Amazon. Amazon is overwhelmed and not real great at watching their inventory levels so his #1 job each morning is to visit all his product pages and fire off email reminders when stock is low. Thought I could make his life a lot easier if he just hit a report page using your plugin. Plus trying to save myself some work right now even though I’m going to have to get into the Amazon Web Services soon.
Any info/direction would be greatly appreciated...Love the plugin!!!
Update...
1) I’m now getting the Amazon Price after reading the Amazon Web Services info. Of course, I read all the v4 docs before I realized the plugin uses the v3 APIs/SDK :-(
2) The plugin pulls down data in “lite” mode. Changing it to “heavy” brings down a lot more data including the stuff I needed. Had to create some additional tags in “pi.amazon.php” file. I now have “prod_availability”, sales_rank, etc. Need to get customer reviews yet but that comes down as an array as far as I can tell. Not being a programmer, I’ll have to get a php-type to figure that out. I know just enough to be dangerous
I couldn’ get a ‘developer’s token’, hey gave me a ‘subscription ID’ instead.
Is that the same, or do I need to do something different. I can’t get it to work.
Jon...
I’m pretty sure it is. Somewhere on the Amazon developer site they mention that they changed the name of it...as I recall anyway
On Second Thought...
Uhhhh...they used to be called “tokens: and they changed it to developer “id” so I’m not 100% sure the “subscription” is the same as “developer”. Been awhile since I poked around the Amazon site.
But as I recall, they first sent me a temporary id (subscription?) and then awhile later sent another email verifying that I was accepted and that temporary id became my developer id.
Price missing...I’ve found that happens off and on. Also, at times Amazon is sooo slow. This pluging use their old APIs, wonder if their new ones are more reliable and faster.
Unfortunately I’ve had absolutely no time to fiddle with this plugin. I’d like to get back to it some day, but for now, consider it “as-is”
There are a couple more EE Amazon plugins out there right now which might be more updated than this one. I’ve seen them, but I’m not sure off the top of my head who did them or where they can be located.
New plugins...I know of one that uses the new APIs but it also requires PHP5 which most hosts I use (including pMhosting) won’t install till early spring.
There’s a website specifically set up for cataloging plugins for EE. You’ll find it at: http://plugins.pmachine.com/.
Hi,
Not sure if this forum is still live but I am in desperate need for some help just to get it working. Is there special software or something that I need to install on my server? All I’m getting are parse errors.
Could you provide an example on how to build a page. I must be doing something really bad as every-one else seemed to have got it working no problem. :(
I hope some-one can help
Mark
Mark...
I’m presuming you are using EE. You need to download the Amazon Plugin (link a couple posts up), install that in the EE system plugins folder on your server, set up your page for the plugin tags, and that’s about it. You can find a couple example links here...Scroll down toward the end, look for Amazon. There’s the plugin method as well as one using RSS and the REST method.
Hope that helps.
Hi,
Call me stupid!! I’ll let you
I came to this page through google so knew nothing about EE before I last posted here. It’s abit to expensive for me, so the search continues…
Mark
I really like the Amazon plug-in but I wonder if anyone can help with this problem:
I want to search for an author say Joe Bloggs but I might get books by the joint authors ‘Joe Smith’ and ‘Daisy Bloggs’, because the plugin is configured to separate out the two words separated by spaces. What I need is to ONLY get books by the author Joe Bloggs. I have tried separating the words by and all sorts but I cannot see where this is happening. Any hacks / advice really appreciated!
Mark...
You might want to look at pMachinePro if EE is too much. It’s free and I think there is an Amazon plugin for that also...it would be different than this one I believe.
Also, in my link above, the REST method *AmazonRSS) does everything through the URL and returns XML. I’m using another EE plugin to parse that XML but there are plenty of tutorials on the net (search Google) for how to do it.
Chris...
It’s been a long time since I monkeyed around with this so I really can’t remember all the things I tried but, the plugin tag for author is “amz_authors”. I would think you’d be able to do an “if” statement to just select/display a certain author as it parses through the list.
Thanks PXLated. I tried that but can’t get is to work.Maybe I can’t use this in a conditional/if statement.
You can’t use an if statement because that’s something that needs to be passed through the plugin, therefore programmed into the plugin and the only two conditionals I programmed are above.
You might be able to use PHP, but I’m not sure of that either because of when the information is pulled from amazon and parsed through EE.
Like I mentioned, been a long time since I set mine up, and it’s not something I need or use, was simply an experiment. So you need the experts to figure this out
I am concluding that the ONLY way to be sure to get an author’s book out is to use the ISBN/ASIN, so I need to put a list of those in a custom-field and then loop through. The keyword search seems to do this but not ASIn search, which is set up to just search for one.
Thanks for your thoughts!
In my plugin (Soap) example...links above...I have one EE entry per record (book/product) with the ISBN/ASIN and it loops through all open records and displays them. If I don’t want to show a particular book/product, I just close the EE entry.