Amazon and Aleph OPAC
Tags: php
, amazon
, opac
, aleph
Last Updated: Oct 30, 2009 00:48
- Description
By using the Amazon webservices API you can embedd data from the bookstore in your OPAC. This example pulls Editorial reviews and bookcovers from Amazon based on a ISBN in the bibliographic record.
- Author: Daniel Forsman
- Institution: Högskolan i Jönköping
- Year:
- 2008
- License: BSD style
- Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
- Link to terms: [Detailed license terms]
- Skill required for using this code:
advanced
State
Stable
Programming language
PHP5, Javascript
Software requirements
It is required that you have PHP installed on your Aleph webserver since the AJAX call has to be local due to security.
The Javascript framework Prototype is required for the AJAX (httprequest) call.
Screen captures
Author(s) homepage
Download
See attachments
Working example
Installation instructions
1. Since we are going to use the Amazon Webservices you will need to register an AWS account and obtain a Access Key ID for you application. This requires that you read and accept the terms of use.
2. Download the javascript framework Prototype
3. Make Prototype available in your OPAC. We include it in meta-tags<Code sample>
<script type="text/javascript" src="path_to_where_you_put_it/prototype.js" ></script>
</Code sample>
4. You will need to provide a hook for the ISBN. Repeat the ISBN label (from edit-doc-999) in full-999-body. We don't use the field labels anymore so this is how it looks for us.
If you want the field label then this is a example of including the label, it is just a matter of repeating the variable:
5. You will need to decide where you want the Amazon information to appear. full-set-tail-XXX is where we put it. Add a ID for the amazon content.
6. With a javascript you read the DOM of the page and get the ISBN. Include the Javascript in full-set-tail-XXX. You can include the javascript (amazon.js) like this
or you can write the javascript inline, like in the following examples.
7. The ISBN is now stored in the xisbn variable. The next step is to pass that on to the PHP script that will query AWS. We do that with Prototype.
8. The PHP script receives the ISBN and passes it on to AWS. The result of the AWS answer is brought back to the OPAC page. Make sure that you include your application ID in the php script.
| Tip sample |
| Info sample |
TO DO list
Perhaps include some other data from Amazon... reviews, ratings etc. But that is kind of easy to include if you know about the AWS API, so if you want it look there
Known issues
If you have multiple ISBN (020a|) in your bibliographic view then the last one is the one that gets sent of to Amazon.
Comments


2 Comments
comments.show.hideOct 23, 2008
Daniel Forsman
This is a nice little blogpost from the Koha developerson the legal side of using AWS.
Aug 19, 2009
Daniel Forsman
After August 15, 2009 in order to use Amazon's Product Advertising API a timestamp and signature must be included with each request made to Amazon.com. I have updated my production code and will upload it to EC as soon I have verified that it works ok. If you need to do something about it right away please contact me or look here: http://forums.digitalpoint.com/showthread.php?t=1366791, I also found the Signed Requests Helper useful : http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html