2017-02-12 132 views
0

我想使用亞馬遜產品廣告API獲取ASIN的兩個價格。一個價格是亞馬遜出售的產品,另一個是第三方銷售產品的最低價格(就像它在camelcamelcamel上完成的一樣)。亞馬遜產品廣告API。如何獲得不是亞馬遜賣家的最低價格?

我使用OfferFull響應組並檢查響應中的Merchant.Name字段以查看產品是否由Amazon銷售。

所以如果不是這樣,那麼我在Offer中獲得了第三方賣家最便宜的價格,而我所要做的就是發佈另一個帶有參數MerchantId = Amazon的請求來獲得Amazon優惠。但是如果亞馬遜有最好的報價呢?有沒有辦法找出第三方賣家的最低價格?

回答

0

把你的反應組 「優惠」 和optionalParameters設置MERCHANTID爲 「所有」

例子:

$response = $this->amazon->responseGroup("Medium,Offers")->optionalParameters(['MerchantId'=>'All'])->lookup($amazon_asin); 

而且他們

if(isset($item->Offers->Offer->OfferListing->Price->CurrencyCode)){ 
    $amazon_data_price = $item->Offers->Offer->OfferListing->Price; 
}elseif(isset($item->OfferSummary->LowestNewPrice->CurrencyCode)){ 
    $amazon_data_price = $item->OfferSummary->LowestNewPrice; 
}elseif(isset($item->ItemAttributes->ListPrice->CurrencyCode)){ 
    $amazon_data_price = $item->ItemAttributes->ListPrice; 
}elseif(isset($item->Offers->Offer->OfferListing->SalePrice->CurrencyCode)){ 
    $amazon_data_price = $item->Offers->Offer->OfferListing->SalePrice; 
}