I would appreciate if anyone could guide me on the correct way on doing an ItemLookup by ISBN using the Zend Amazon Service module (with Zend 2.0).
Here is my attempt:
$query = new ZendService\Amazon\Query($appId, 'UK', $secretKey);
$query->Category('Books')->IdType('ISBN')->ItemID('978-0321784070')->AssociateTag($tag);
$result = $query->ItemLookup();
But I get the following errors:
- Missing argument 1 for ZendService\Amazon\Amazon::itemLookup(), called in D:\wamp\www\site\controllers\dev.php on line 122 and defined
- Undefined variable: asin
There is no way I can define the ASIN because the only information I will have is the ISBN.
I have already consulted the Zend Service Amazon user guide in the zend framework website but it is outdated and doesn't demonstrate how to do an ISBN lookup. I have also looked at the demo that came with the zend amazon package but that only details how to do item searches, not lookups.
Here is a way to get the ISBN search working, it took me a little while to get it figured out as well. The problem was that in order to search for ISBN you must use the
ItemLookup
method rather than theItemSearch
method which was getting set by thequery()
method.There may be a better way to get this to work using the OO interface but I haven't tried that yet.
Searching by ISBN should return a single
ZendService\Amazon\Item
object rather than an array of results. Also be aware, if you search by ISBN-13, you need to strip the-
from the number or it won't find a match.Credit to this blog post by Manas Tungare which hinted to me that we need to use IteamLookup instead of ItemSearch.