【问题标题】:How to get Amazon Customer review on magento site如何在 magento 网站上获得亚马逊客户评论
【发布时间】:2014-09-04 07:46:13
【问题描述】:

我想在我的 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 中 AWSAccessKeyIdSignature 正在使用 .... 我得到了 AWSAccessKeyId 但我没有找到 Signature

所以请你告诉我,我从哪里得到亚马逊的签名密钥。

【问题讨论】:

标签: magento amazon-web-services amazon-ec2 amazon magento-1.8


【解决方案1】:

我们可以通过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

【讨论】:

    猜你喜欢
    • 2017-07-28
    • 1970-01-01
    • 2012-03-24
    • 1970-01-01
    • 2013-07-22
    • 1970-01-01
    • 2012-01-31
    • 2018-07-21
    • 1970-01-01
    相关资源
    最近更新 更多