|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00032 class Zend_Service_Amazon_Offer 00033 { 00037 public $MerchantId; 00038 00042 public $MerchantName; 00043 00047 public $GlancePage; 00048 00052 public $Condition; 00053 00057 public $OfferListingId; 00058 00062 public $Price; 00063 00067 public $CurrencyCode; 00068 00072 public $Availability; 00073 00077 public $IsEligibleForSuperSaverShipping = false; 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 $this->MerchantId = (string) $xpath->query('./az:Merchant/az:MerchantId/text()', $dom)->item(0)->data; 00090 $name = $xpath->query('./az:Merchant/az:Name/text()', $dom); 00091 if ($name->length == 1) { 00092 $this->MerchantName = (string) $name->item(0)->data; 00093 } 00094 $this->GlancePage = (string) $xpath->query('./az:Merchant/az:GlancePage/text()', $dom)->item(0)->data; 00095 $this->Condition = (string) $xpath->query('./az:OfferAttributes/az:Condition/text()', $dom)->item(0)->data; 00096 $this->OfferListingId = (string) $xpath->query('./az:OfferListing/az:OfferListingId/text()', $dom)->item(0)->data; 00097 $Price = $xpath->query('./az:OfferListing/az:Price/az:Amount', $dom); 00098 if ($Price->length == 1) { 00099 $this->Price = (int) $xpath->query('./az:OfferListing/az:Price/az:Amount/text()', $dom)->item(0)->data; 00100 $this->CurrencyCode = (string) $xpath->query('./az:OfferListing/az:Price/az:CurrencyCode/text()', $dom)->item(0)->data; 00101 } 00102 $availability = $xpath->query('./az:OfferListing/az:Availability/text()', $dom)->item(0); 00103 if($availability instanceof DOMText) { 00104 $this->Availability = (string) $availability->data; 00105 } 00106 $result = $xpath->query('./az:OfferListing/az:IsEligibleForSuperSaverShipping/text()', $dom); 00107 if ($result->length >= 1) { 00108 $this->IsEligibleForSuperSaverShipping = (bool) $result->item(0)->data; 00109 } 00110 } 00111 }