How to get Amazon Customer review on magento site

柔情痞子 提交于 2019-12-10 12:05:21

问题


i want to show the amazon customer review on my magento site ... i searched a lot and i found some links which showing me the steps for this..

<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]" /> 

In this iframe AWSAccessKeyId and Signature is using .... i got the AWSAccessKeyId but i haven't found the Signature.

so please can you tell me, from where i get the Signature key of amazon.


回答1:


We can easily get the customer review by using Amazon-ECS-PHP-Library .By Using this class the app generates an URL to an Amazon page with only the reviews on it , based on its ISBN number.

The code

# 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)
     );
   }

Please check this link, for more details.. Show Amazon book reviews on your site with the Product Advertising API



来源:https://stackoverflow.com/questions/25659923/how-to-get-amazon-customer-review-on-magento-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!