2017-03-10 3 views
2

내 코드는 여기에 있지만 제 3 자 판매자로부터 최저 가격을 반환합니다. 내가 잘못하고있는 것은 무엇입니까? 응답 그룹 오퍼를 사용 중이므로 문서에 따라 결과를 얻는 방법입니다.amazon merchantID에 대해서만 amazon API 제품 가격을 검색하는 방법

function getAmazonPrice($region, $asin) { 

    $xml = aws_signed_request($region, array(
     "Operation" => "ItemLookup", 
     "ItemId" => $asin, 
     "IncludeReviewsSummary" => False, 
     "ResponseGroup" => "Medium, Offers", 
     "MerchantId" => "Amazon", 
    )); 

    $item = $xml->Items->Item; 
    $title = htmlentities((string) $item->ItemAttributes->Title); 
    $url = htmlentities((string) $item->DetailPageURL); 
    $image = htmlentities((string) $item->MediumImage->URL); 
    $price = htmlentities((string) $item->OfferSummary->LowestNewPrice->Amount); 
    $code = htmlentities((string) $item->OfferSummary->LowestNewPrice->CurrencyCode); 
    $qty = htmlentities((string) $item->OfferSummary->TotalNew); 

    if ($qty !== "0") { 
     $response = array(
      "code" => $code, 
      "price" => number_format((float) ($price/100), 2, '.', ''), 
      "image" => $image, 
      "url" => $url, 
      "title" => $title 
     ); 
    } 

    return $response; 
} 

답변

0

동일한 문제가 있습니다.

$ SalePrice = $ xmlProduct-> 항목 -> 항목 -> 오퍼 -> 할인 상품> OfferListing-> SalePrice-> 금액 :

은 내가 아마존은 할인 혜택을 제공 할 때 가정되는 한, 그것은 SalePrice에 ;

경우 존재 나던 그 노드, 다음 더 할인, 단지 리스팅 가격 사용은 없다 : $ xmlProduct-> 항목 -> 항목 -> 오퍼 -> 할인 상품> OfferListing-> 가격 -> 금액