Просмотр исходного кода

fixes issue ZF-7253. Notice: Trying to get property of non-object.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18619 44c647ce-9c0f-0410-b52a-842ac1e357ba
klassicd 16 лет назад
Родитель
Сommit
162811a9a1
2 измененных файлов с 7 добавлено и 4 удалено
  1. 5 2
      library/Zend/Service/Amazon/Offer.php
  2. 2 2
      library/Zend/Service/Amazon/OfferSet.php

+ 5 - 2
library/Zend/Service/Amazon/Offer.php

@@ -85,8 +85,11 @@ class Zend_Service_Amazon_Offer
         $this->GlancePage = (string) $xpath->query('./az:Merchant/az:GlancePage/text()', $dom)->item(0)->data;
         $this->Condition = (string) $xpath->query('./az:OfferAttributes/az:Condition/text()', $dom)->item(0)->data;
         $this->OfferListingId = (string) $xpath->query('./az:OfferListing/az:OfferListingId/text()', $dom)->item(0)->data;
-        $this->Price = (int) $xpath->query('./az:OfferListing/az:Price/az:Amount/text()', $dom)->item(0)->data;
-        $this->CurrencyCode = (string) $xpath->query('./az:OfferListing/az:Price/az:CurrencyCode/text()', $dom)->item(0)->data;
+        $Price = $xpath->query('./az:OfferListing/az:Price/az:Amount', $dom);
+        if ($Price->length == 1) {
+        	$this->Price = (int) $xpath->query('./az:OfferListing/az:Price/az:Amount/text()', $dom)->item(0)->data;
+        	$this->CurrencyCode = (string) $xpath->query('./az:OfferListing/az:Price/az:CurrencyCode/text()', $dom)->item(0)->data;
+        }
         $availability = $xpath->query('./az:OfferListing/az:Availability/text()', $dom)->item(0);
         if($availability instanceof DOMText) {
             $this->Availability = (string) $availability->data;

+ 2 - 2
library/Zend/Service/Amazon/OfferSet.php

@@ -89,12 +89,12 @@ class Zend_Service_Amazon_OfferSet
 
         $offer = $xpath->query('./az:OfferSummary', $dom);
         if ($offer->length == 1) {
-            $lowestNewPrice = $xpath->query('./az:OfferSummary/az:LowestNewPrice', $dom);
+            $lowestNewPrice = $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:Amount', $dom);
             if ($lowestNewPrice->length == 1) {
                 $this->LowestNewPrice = (int) $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:Amount/text()', $dom)->item(0)->data;
                 $this->LowestNewPriceCurrency = (string) $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:CurrencyCode/text()', $dom)->item(0)->data;
             }
-            $lowestUsedPrice = $xpath->query('./az:OfferSummary/az:LowestUsedPrice', $dom);
+            $lowestUsedPrice = $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:Amount', $dom);
             if ($lowestUsedPrice->length == 1) {
                 $this->LowestUsedPrice = (int) $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:Amount/text()', $dom)->item(0)->data;
                 $this->LowestUsedPriceCurrency = (string) $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:CurrencyCode/text()', $dom)->item(0)->data;