How to make ItemLookup with Amazon Zend Service?

I would appreciate it if someone could direct me to the right path when executing ItemLookup ISBN using the Amazon Service Zend 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:

  • Argument 1 is missing for ZendService \ Amazon \ Amazon :: itemLookup (), called in D: \ wamp \ www \ site \ controllers \ dev.php on line 122 and is defined
  • Undefined variable: asin

It is not possible to determine ASIN because the only information I will have is ISBN.

I already consulted the Zend Service Amazon user guide on the zend framework website, but it is outdated and does not demonstrate how to perform an ISBN search. I also looked at the demo that appeared with the zend amazon package, but this only details how to search for items, not search.

+1
source share
1 answer

Here is a way to look for an ISBN job, it took me a little time to figure it out. The problem was that you should use the ItemLookup method rather than the ItemSearch method, which was set by the query() method, to search for ItemLookup .

Maybe the best way to get this to work is using the OO interface, but I haven't tried it yet.

 $query = new ZendService\Amazon\Query($appId, 'US', $secretKey); $item = $query->itemLookup('9780321784070', array('SearchIndex' => 'Books', 'AssociateTag' => $tag, 'IdType' => 'ISBN', 'ResponseGroup' => 'Small',)); 

An ISBN search should return a single ZendService\Amazon\Item object, not an array of results. Also keep in mind that if you are searching for ISBN-13, you need to delete - from the number or not find a match.

Subscribe to this blog post from Manas Tungare, which hinted to me that we need to use IteamLookup instead of ItemSearch.

+3
source

Source: https://habr.com/ru/post/1440667/


All Articles