Beispiel #1
0
        try
	{
		$opt = array('resource' => 'products');
		if ($_GET['Create'] == 'Creating')
		{
                    $prdID=(int)ProductCore::getProductIdByReference($product_xml->ItemNumber);
                     if(!$prdID){
                        $opt['postXml'] = $xml->asXML();
                        $xml = $webService->add($opt);
                        ProductCore::addCustomField($xml->product->id,1,0,'decoCount');
                        ProductCore::addCustomField($xml->product->id,1,0,'checkbox');
                        foreach ($decoration1 as $deco){
                            ProductCore::addCustomField($xml->product->id,1,0,$deco['TecnicaFull']);
                            ProductCore::addCustomField($xml->product->id,1,0,'Price - '.$deco['TecnicaFull']);
                        }
                        ProductCore::addAttachments($xml->product->id, 1);
                        ProductCore::updateCacheAttachment((int)$xml->product->id);                    
                     }else{         
                        $resources->id=$prdID;
                        $opt['putXml'] = $xml->asXML();
                        $opt['id'] = $prdID ;
                        var_dump($opt);
                        $xml = $webService->edit($opt);
                        ProductCore::deleteAllCustomField($xml->product->id);
                        ProductCore::addCustomField($xml->product->id,1,0,'decoCount');
                        ProductCore::addCustomField($xml->product->id,1,0,'checkbox');
                        foreach ($decoration1 as $deco){
                            ProductCore::addCustomField($xml->product->id,1,0,$deco->TecnicaFull);
                            ProductCore::addCustomField($xml->product->id,1,0,'Price - '.$deco->TecnicaFull);
                        }
                     }