0
votes

I'd like to get two prices for an ASIN using the Amazon Product Advertising API. One price is for the product sold by Amazon and the other - the lowest price for the product sold by a 3rd party (much like it's done on camelcamelcamel).

I use OfferFull response group and check the Merchant.Name field in the response to see if the product is sold by Amazon or not.

So if it's not, then I got the cheapest price for a 3rd party seller in the Offer, and all I left to do is to issue another request with a parameter MerchantId=Amazon to get only Amazon deals. But what if the Amazon has the best offer? Is there a way to figure out what is the lowest price for 3rd party sellers then?

1

1 Answers

0
votes

Put in your RESPONSE GROUP "Offers" and in optionalParameters set MerchantId to "All"

Example:

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

And them

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