/** * Create a new ProductIdentifier. * * @param mixed $in The <ProductIdentifier> DOMDocument or DOMElement. */ public function __construct($in) { parent::__construct($in); // Retrieve and check the type. try { $this->availability_code = $this->_getSingleChildElementText('AvailabilityCode'); } catch (\Exception $e) { } try { $this->product_availability = $this->_getSingleChildElementText('ProductAvailability'); } catch (\Exception $e) { } try { $this->on_sale_date = $this->_getSingleChildElementText('OnSaleDate'); } catch (\Exception $e) { } if (!$this->on_sale_date) { try { $this->on_sale_date = $this->_getSingleChildElementText('SupplyDate/Date'); } catch (\Exception $e) { } } // Get the prices. $this->prices = array(); $prices = $this->xpath->query("/*/Price"); foreach ($prices as $price) { //error_log(print_r($price, true)); $this->prices[] = array('PriceTypeCode' => $this->_getPriceData($price, 'PriceTypeCode'), 'PriceAmount' => $this->_getPriceData($price, 'PriceAmount'), 'CurrencyCode' => $this->_getPriceData($price, 'CurrencyCode'), 'PriceEffectiveFrom' => $this->_getPriceData($price, 'PriceEffectiveFrom')); } // Save memory. $this->_forgetSource(); }
/** * Create a new Subject. * * @param mixed $in The <Subject> DOMDocument or DOMElement. */ public function __construct($in) { parent::__construct($in); try { $this->scheme = $this->_getSingleChildElementText('SubjectSchemeIdentifier'); } catch (\Exception $e) { } try { $this->value = $this->_getSingleChildElementText('SubjectCode'); } catch (\Exception $e) { } try { $this->text = $this->_getSingleChildElementText('SubjectHeadingText'); } catch (\Exception $e) { } try { $this->_getSingleChildElementText('MainSubject'); $this->mainSubject = true; } catch (\Exception $e) { $this->mainSubject = false; } // Save memory. $this->_forgetSource(); }