|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00032 class Zend_Service_Amazon_OfferSet 00033 { 00037 public $LowestNewPrice; 00038 00042 public $LowestNewPriceCurrency; 00043 00047 public $LowestUsedPrice; 00048 00052 public $LowestUsedPriceCurrency; 00053 00057 public $TotalNew; 00058 00062 public $TotalUsed; 00063 00067 public $TotalCollectible; 00068 00072 public $TotalRefurbished; 00073 00077 public $Offers; 00078 00085 public function __construct(DOMElement $dom) 00086 { 00087 $xpath = new DOMXPath($dom->ownerDocument); 00088 $xpath->registerNamespace('az', 'http://webservices.amazon.com/AWSECommerceService/2005-10-05'); 00089 00090 $offer = $xpath->query('./az:OfferSummary', $dom); 00091 if ($offer->length == 1) { 00092 $lowestNewPrice = $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:Amount', $dom); 00093 if ($lowestNewPrice->length == 1) { 00094 $this->LowestNewPrice = (int) $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:Amount/text()', $dom)->item(0)->data; 00095 $this->LowestNewPriceCurrency = (string) $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:CurrencyCode/text()', $dom)->item(0)->data; 00096 } 00097 $lowestUsedPrice = $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:Amount', $dom); 00098 if ($lowestUsedPrice->length == 1) { 00099 $this->LowestUsedPrice = (int) $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:Amount/text()', $dom)->item(0)->data; 00100 $this->LowestUsedPriceCurrency = (string) $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:CurrencyCode/text()', $dom)->item(0)->data; 00101 } 00102 $this->TotalNew = (int) $xpath->query('./az:OfferSummary/az:TotalNew/text()', $dom)->item(0)->data; 00103 $this->TotalUsed = (int) $xpath->query('./az:OfferSummary/az:TotalUsed/text()', $dom)->item(0)->data; 00104 $this->TotalCollectible = (int) $xpath->query('./az:OfferSummary/az:TotalCollectible/text()', $dom)->item(0)->data; 00105 $this->TotalRefurbished = (int) $xpath->query('./az:OfferSummary/az:TotalRefurbished/text()', $dom)->item(0)->data; 00106 } 00107 $offers = $xpath->query('./az:Offers/az:Offer', $dom); 00108 if ($offers->length >= 1) { 00112 require_once 'Zend/Service/Amazon/Offer.php'; 00113 foreach ($offers as $offer) { 00114 $this->Offers[] = new Zend_Service_Amazon_Offer($offer); 00115 } 00116 } 00117 } 00118 }