问题描述
我AP preciate如果有人可以指导我对使用Zend亚马逊服务模块(与Zend 2.0)通过ISBN做一个ItemLookup的正确方法。
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).
下面是我的尝试:
$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:
- 缺少参数1 ZendService \\亚马逊\\亚马逊:: itemLookup(),称为D:\\ WAMP \\ WWW \\网站\\控制器\\ dev.php线122和定义
- 未定义的变量:ASIN
有没有办法,我可以定义ASIN,因为我将有唯一信息是ISBN。
There is no way I can define the ASIN because the only information I will have is the ISBN.
我已经咨询了Zend框架的网站了Zend服务亚马逊用户指南,但它已经过时,不演示了如何做一个ISBN查找。我也看着那个带有Zend亚马逊包附带的演示,但只详细介绍了如何做项目搜索,查找不
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.
推荐答案
下面是一种方式来获得书号的搜索工作,我花了一些时间来把它想通了为好。问题是,为了寻找书号,你必须使用 ItemLookup
方法,而不是 ItemSearch
方法,它是越来越由查询设置()
方法。
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 the ItemSearch
method which was getting set by the query()
method.
有可能是一个更好的方式来得到这个使用OO接口工作,但我还没有试过呢。
There may be a better way to get this to work using the OO interface but I haven't tried that yet.
$query = new ZendService\Amazon\Query($appId, 'US', $secretKey);
$item = $query->itemLookup('9780321784070',
array('SearchIndex' => 'Books',
'AssociateTag' => $tag,
'IdType' => 'ISBN',
'ResponseGroup' => 'Small',));
由ISBN搜索应该返回一个 ZendService \\亚马逊\\项目
对象,而不是结果的数组。另外要注意,如果您通过ISBN-13搜索,你需要剥去 -
从数量还是不会找到一个匹配
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.
感谢这个博客文章通过马纳斯Tungare这暗示,我认为我们需要使用IteamLookup,而不是ItemSearch。
Credit to this blog post by Manas Tungare which hinted to me that we need to use IteamLookup instead of ItemSearch.
这篇关于怎么办ItemLookup与Zend服务亚马逊?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!