function disableDeletedProducts(){ global $webService, $product_added; $allproducts= ProductCore::getAllProductsIdAddedByWebservice(); //var_dump($allproducts); try { $opt = array('resource' => 'products'); $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/products/'.'322')); $resources = $xml->children()->children(); unset($resources->manufacturer_name); unset($resources->quantity); $resources->active = 0; $resources->id=322; $opt['putXml'] = $xml->asXML(); $opt['id'] = 322; $xml = $webService->edit($opt); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->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 />'.$e->getMessage(); } }