示例#1
0
 /**
  * Get Matching Product For Id
  * GetMatchingProduct will return the details (attributes) for the
  * given Identifier list. Identifer type can be one of [SKU|ASIN|UPC|EAN|ISBN|GTIN|JAN]
  *
  * @param mixed $request array of parameters for GetMatchingProductForId request or GetMatchingProductForId object itself
  *
  * @see GetMatchingProductForIdRequest
  * @return Model\GetMatchingProductForIdResponse
  *
  * @throws MwsProductsException
  */
 public function getMatchingProductForId($request)
 {
     if (!$request instanceof Model\GetMatchingProductForIdRequest) {
         $request = new Model\GetMatchingProductForIdRequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'GetMatchingProductForId';
     $httpResponse = $this->_invoke($parameters);
     $response = Model\GetMatchingProductForIdResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
 * Uncomment to try out Mock Service that simulates MarketplaceWebServiceProducts
 * responses without calling MarketplaceWebServiceProducts service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under MarketplaceWebServiceProducts/Mock tree
 *
 ***********************************************************************/
// $service = new MwsProductsMock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for Get Matching Product For Id Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as GetMatchingProductForId
$request = new GetMatchingProductForIdRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeGetMatchingProductForId($service, $request);
/**
 * Get Get Matching Product For Id Action Sample
 * Gets competitive pricing and related information for a product identified by
 * the MarketplaceId and ASIN.
 *
 * @param MwsProductsInterface $service instance of MwsProductsInterface
 * @param mixed                                   $request GetMatchingProductForId or array of parameters
 */
function invokeGetMatchingProductForId(MwsProductsInterface $service, $request)
{
    try {
        $response = $service->GetMatchingProductForId($request);