使用MWS获取产品信息时重新定义参数$ quotaMax错误

时间:2016-06-24 00:20:47

标签: php amazon-mws

我正在尝试使用亚马逊MWS API从产品中获取信息,我发现了这个恼人的错误:

致命错误:重新定义参数$ quotaMax ....(文件ResponseHeaderMetadata.php的路径)

我的MWS凭据没问题,因为我在MWS暂存器上尝试了完全相同的凭据,并且响应是正确的。我的代码正在使用Products API的MWS示例。我正在使用GetMatchingProductSample.php,最重要的部分是:

$asin_list = new MarketplaceWebServiceProducts_Model_ASINListType();
$asin_list->setASIN(array("B01BH9EXX2"));

$request = new MarketplaceWebServiceProducts_Model_GetMatchingProductRequest();
$request->setMarketplaceId(MARKETPLACE_ID);
$request->setASINList($asin_list);

invokeGetMatchingProduct($service, $request);

当获得请求的转储时,一切似乎都没问题,再次:

$parameters = $request->toQueryParameterArray();
var_dump($parameters);

array(2){[“MarketplaceId”] => string(13)“ATVPDKIKX0DER”[“ASINList.ASIN.1”] => string(10)“B01BH9EXX2”}

MWS API文档不是很好。

由于

3 个答案:

答案 0 :(得分:12)

尝试以下....

打开您的MarketplaceWebServices-> model-> ResponseHeaderMetadata.php

查找并替换以下代码

public function __construct($requestId = null, $responseContext = null, $timestamp = null,$quotaMax = null, $quotaMax = null, $quotaResetsAt = null){

public function __construct($requestId = null, $responseContext = null, $timestamp = null,$quotaMax = null, $quotaRemaining = null, $quotaResetsAt = null) {

:)

答案 1 :(得分:5)

除上述换行外,行:

$this->metadata[self::QUOTA_REMAINING] = $quotaMax;

应改为

$this->metadata[self::QUOTA_REMAINING] = $quotaRemaining;

此致

答案 2 :(得分:1)

  1. 打开文件“ MWSMerchantFulfillmentService / Model / ResponseHeaderMetadata.php”

  2. 替换

    公共函数__construct($ requestId = null,$ responseContext = null,$ timestamp = null,$ quotaMax = null,$ quotaMax = null,$ quotaResetsAt = null){

    使用

    公共函数__construct($ requestId = null,$ responseContext = null,$ timestamp = null,$ quotaMax = null,$ quotaRemaining = null,$ quotaResetsAt = null)

  3. 替换

    $ this-> metadata [self :: QUOTA_REMAINING] = $ quotaMax;

    使用

    $ this-> metadata [self :: QUOTA_REMAINING] = $ quotaRemaining;