Ejemplo n.º 1
0
 /**
  * Initilizate inventory cost parameters by getted SimpleXMLElement.
  * @param SimpleXMLElement $offer
  * @return \CmlProduct
  */
 private function initilizatePackageInventory($offer)
 {
     $priceXmlElement = $this->getMandatoryPriceElement($offer);
     $price = $this->getMandatoryChildContent($priceXmlElement, 'ЦенаЗаЕдиницу', 'Not product price in offers.xml');
     $currency = $this->getChildContent($priceXmlElement, 'Валюта');
     $conversionRate = $this->getChildContent($priceXmlElement, 'Коэффициент');
     $name = $this->getMandatoryChildContent($offer, 'Наименование', 'Not product name in offers.xml');
     $name = $this->filter($name);
     $oneEsIdentifier = $this->getMandatoryChildContent($offer, 'Ид', 'Not product identificator in offers.xml');
     $count = $this->getChildContent($offer, 'Количество');
     $inventory = new CmlProduct();
     $inventory->offersInitilizate($oneEsIdentifier, $name, $price, $currency, $conversionRate, $count);
     return $inventory;
 }