Web Design Blog

January 18, 2015

I am using the Amazon Feeds API to automate listing items on Amazon for clients. My clients run a variety of shopping carts and CMS’s ranging from osCommerce to custom frameworks so a simple plugin doesn’t suit my needs. As is usually the case I need to be able to understand and customize my own per each individual client.

Unfortunately the documentation is a little sparse and fragmented for such a large and unforgiving specification. I will document some of the initial challenges I have run into as Google doesn’t seem to be able to provide quick answers.

Errors in the Feeds API PHP Client Library

There is a couple of ‘bugs’ in the Amazon Feeds API Section Client Library – PHP – Version 2009-01-01

Fatal error: Call to undefined method MarketplaceWebService_Model_GetFeedSubmissionResultResponse::_toXMLFragment() in /MarketplaceWebService/Model/GetFeedSubmissionResultResponse.php on line 189

The MarketplaceWebService_Model_GetFeedSubmissionResultResponse and SubmitFeedResponse call the _toXML() method. The method in the parent abstract class (MarketplaceWebService_Model) is named toXML().
Change line to:
$xml .= $this->toXMLFragment();

The next error is:

Catchable fatal error: Object of class DateTime could not be converted to string in /MarketplaceWebService/Model.php on line 140

The private method escapeXML of Model.php tries to run str_replace on a DateTime object. I resolved this issue by adding
if(is_object($str))
return;

to the top of the function.

Fork on Github

Comments

comments

Powered by Facebook Comments