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); } } //Configuration::updateValue('PRODUCTUPDATE_STATUS', '50'); set_price_rule($xml->product->id, $product_xml->ItemNumber, $list); save_product_combination($xml->product->id, $product_xml->ItemNumber,$list, $decoration,$product_xml->Color); array_push($product_added, $xml->product->id); Configuration::updateValue('PRODUCTUPDATE_STATUS', $count/40); echo "Successfully added."; } } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors $trace = $ex->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID';
$resources->youtube_link->language[0][0] = utf8_encode($product_details->Video); $resources->link_rewrite->language[0][0] = Tools::link_rewrite($product_details->ShortName); if (!isset($resources->date_add) || empty($resources->date_add)) $resources->date_add = date('Y-m-d H:i:s'); $resources->date_upd = date('Y-m-d H:i:s'); try { $opt = array('resource' => 'products'); if ($_GET['Create'] == 'Creating') { $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); set_price_rule($xml->product->id, $product_xml->ItemNumber, $list); save_product_combination($xml->product->id, $product_xml->ItemNumber,$list, $decoration,$product_xml->Color); ProductCore::addCustomField($xml->product->id,1,0,1,'Upload Logo'); ProductCore::addAttachments($xml->product->id, 1); ProductCore::updateCacheAttachment((int)$xml->product->id); echo "Successfully added."; } } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors $trace = $ex->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error<br />'.$ex->getMessage(); } } }