/** * Get reference from cmlService. * @param CmlService $abstractProduct */ public function getReference($abstractProduct) { $name = $abstractProduct->getName(); $result = $this->query("select id from Services where servicename='{$name}';"); return $this->getFirstReference($result); }
/** * Return AbstractProduct by $importProduct * @param SimpleXMLElement $xmlInventoryDescription * @param CmlProduct|CmlService $inventory * @return AbstractProduct */ private function initilizateCatalogInventory($xmlInventoryDescription, $inventory) { $name = $this->getMandatoryChildContent($xmlInventoryDescription, 'Наименование', 'Not product name in import.xml'); $oneEsIdentifier = $this->getMandatoryChildContent($xmlInventoryDescription, 'Ид', 'Not product identificator in import.xml'); $unitName = $this->getChildContent($xmlInventoryDescription, 'БазоваяЕдиница'); $article = $this->getChildContent($xmlInventoryDescription, 'Артикул'); $NDS = $this->getTaxRate($xmlInventoryDescription); /* REST API broke on special symbols */ $name = $this->filter($name); $article = $this->filter($article); $inventory->catalogInitilizate($oneEsIdentifier, $name, $article, $unitName, $NDS); return $inventory; }