Esempio n. 1
0
    /**
     * Get refernece by CmlProduct.
     * @param CmlProduct $abstractProduct
     */
    public function getReference($abstractProduct) {
        $name = $abstractProduct->getName(); 
 	$article = $abstractProduct->getArticle();
        if($article != null) {
            $result = $this->query("select id from Products where productname='$name' "
                . "and productcode='$article';");       //if in article null - request generate error
        } else {
            $result = $this->query("select id from Products where productname='$name';");
        }
        
        return $this->getFirstReference($result);
    }
Esempio n. 2
0
 /**
  * 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;
 }