如何在magento网站上获得亚马逊客户评论

yvt65v4c  于 2023-02-19  发布在  其他
关注(0)|答案(1)|浏览(171)

我想显示亚马逊客户评论在我的magento网站...我搜索了很多,我发现了一些链接,其中显示了我的步骤。

<iframe src="http://www.amazon.com/reviews/iframe?akid=[AWS Access Key ID]&asin=0316067938&exp=2011-08-01T17%3A54%3A07Z&linkCode=xm2&summary=0&tag=ws&truncate=256&v=2&sig=[Signature]" />

在此iframe中,AWSAccessKeyId签名正在使用....我获得了AWSAccessKeyId,但未找到签名
所以请你告诉我,我从哪里得到亚马逊的签名密钥。

mftmpeh8

mftmpeh81#

我们可以通过使用Amazon-ECS-PHP-Library轻松获取客户评论。通过使用该类,应用程序会根据亚马逊页面的ISBN号生成一个指向亚马逊页面的URL,页面上只有评论。
守则

# see comment above about 10 and 13 digit ISBNs 
if($reviews = getAmazonReviews($book['ISBN_10'])) 
{
  $amazonReviewsIframe = $reviews;
} 
else 
{
  $asin = isbnToAsin($book['ISBN_13']);
  $amazonReviewsIframe = getAmazonReviews($asin); 
}

if($amazonReviewsIframe) 
{
 echo "<a class='fboxEdit' href='$amazonReviewsIframe'>Amazon</a>";
}

 # get the first two values from the Product Advertising API, 
 # last 2 values are needed for Amazon-ECS-PHP-Library
 define("API_KEY",         "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
 define("API_SECRET",      "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
 define("COUNTRY_CODE",    "com");
 define("ASSOC_TAG",       "myrealis");

 function amazonApi() 
 {
   # https://github.com/Exeu/Amazon-ECS-PHP-Library/blob/master/lib/AmazonECS.class.php
   require_once 'AmazonECS.class.php'; 
   $client = new AmazonECS(API_KEY, API_SECRET, COUNTRY_CODE, ASSOC_TAG);                                                                
   return $client;
 }

 function getAmazonReviews($asin) 
 {
  $client = amazonApi();
  $response = $client->category('Books')->responseGroup('Reviews')->search($asin);

  if($response->Items->Item->ASIN == $asin) 
  {
   return $response->Items->Item->CustomerReviews->IFrameURL;
  } 
  else 
  {
   return False;
  }
  }

  function isbnToAsin($isbn)
  {
    $client = amazonApi();

    # I extended the AmazonECS.class with the "lookupIsbn" function
    $response  = $client->category('Books')->lookupIsbn($isbn);

     if(isset($response->Items->Item->ASIN)) {
       return $response->Items->Item->ASIN;
     } else {
       return False;
     }
  }

    # added inside the AmazonECS.class

    public function lookupIsbn($isbn) 
   {
     $params = $this->buildRequestParams('ItemLookup', array(
'ItemId' => $isbn, 'IdType' => 'ISBN', 'SearchIndex' => 'Books'
     ));

     return $this->returnData(
     $this->performSoapRequest("ItemLookup", $params)
     );
   }

请点击此链接,了解更多详情.. Show Amazon book reviews on your site with the Product Advertising API

相关问题