Я использую Amazon Product Advertising API PHP Class from Codediesel.Amazon Product Advertising API Чтение сперва Предложение
Я использую функцию getItemByAsin
и изменил ResponseGroup
к Offers
, потому что я хочу, чтобы получить IsEligibleForPrime
для самого дешевого предложения (см Amazon JSON response.
Поскольку существует более 1 предложение в ответ внутри offer
тега, Я не знаю, как читать первый
Вот что réponse выглядит следующим образом:.
<Item>
<ASIN>047061529X</ASIN>
<Offers>
<TotalOffers>2</TotalOffers>
<TotalOfferPages>1</TotalOfferPages>
<MoreOffersUrl>http://www.amazon.com/gp/offer-listing/047061529X/?SubscriptionId=AKIAI44QH8DHBEXAMPLE&ie=UTF8&tag=adrpik-20&creative=386001&camp=2025&linkCode=xm2 </MoreOffersUrl>
<Offer>
<OfferAttributes>
<Condition>New</Condition>
</OfferAttributes>
<OfferListing>
<OfferListingId>6vZH%2FR4dOoabV7sTSv3vC0Np5xK1c8MKOhAl5HYbCIJhxOLlJw1O2AM6mLYyVhjnI8s2gMkx7yq%2F%2BEC7yKPWkQTqhVhFBeUDm71EdpaYwrXpppfcAL1yPzyQFkOuK6MsK8aLPSNSWVs%3D </OfferListingId>
<Price>
<Amount>1025</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$10.25</FormattedPrice>
</Price>
<AmountSaved>
<Amount>974</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$9.74</FormattedPrice>
</AmountSaved>
<PercentageSaved>49</PercentageSaved>
<Availability>Usually ships in 1-2 business days</Availability>
<AvailabilityAttributes>
<AvailabilityType>now</AvailabilityType>
<MinimumHours>24</MinimumHours>
<MaximumHours>48</MaximumHours>
</AvailabilityAttributes>
<IsEligibleForSuperSaverShipping>0</IsEligibleForSuperSaverShipping>
<IsEligibleForPrime>1</IsEligibleForPrime>
</OfferListing>
</Offer>
<Offer>
<OfferAttributes>
<Condition>Used</Condition>
</OfferAttributes>
<OfferListing>
<OfferListingId>uXUlLeu7rH5t3ogkZJ%2Bd11tWCsdsj5kHhjoscRF1D1GuBuDwCyrz0XyR%2BTEOJO7PgpfwLjtX4ojhbXeHZgM0Br4DiWsPhNZTduzvYC8zLgG0z1e%2FgYiiuuR0wTyKqssY6ncHyVjZK1A%3D </OfferListingId>
<Price>
<Amount>1110</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$11.10</FormattedPrice>
</Price>
<AmountSaved>
<Amount>889</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$8.89</FormattedPrice>
</AmountSaved>
<PercentageSaved>44</PercentageSaved>
<Availability>Usually ships in 1-2 business days</Availability>
<AvailabilityAttributes>
<AvailabilityType>now</AvailabilityType>
<MinimumHours>24</MinimumHours>
<MaximumHours>48</MaximumHours>
</AvailabilityAttributes>
<IsEligibleForSuperSaverShipping>0</IsEligibleForSuperSaverShipping>
<IsEligibleForPrime>1</IsEligibleForPrime>
</OfferListing>
</Offer>
</Offers>
Как я могу прочитать IsEligibleForPrime
с первых <Offer></Offer>
?
На какой элемент вы хотите сделать заказ? Самое дешевое или первое предложение? – Zl3n
Я хотел бы получить содержание IsEligibleForPrime первого (самого дешевого) предложения, где условие «новое». – Paul
Хорошо, давайте попробуем что-нибудь – Zl3n