alan.rodrigues Posted August 1, 2017 Share Posted August 1, 2017 (edited) Hello, I'm trying to update the price of my products. The new price will be sent from our ERP. So I'will get it from SQL. Prestashop's returning the follow error: Fatal error: Uncaught PrestaShopWebserviceException: This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request. in /var/inc/bibliotecas/PSWebServiceLibrary.php:91 Stack trace: #0 /var/inc/bibliotecas/PSWebServiceLibrary.php(359): PrestaShopWebservice->checkStatusCode(400) #1 /var/inc/atualizaPrestashop.inc(76): PrestaShopWebservice->edit(Array) #2 /var/www/diprotec/comando.php(11): Prestashop->NovoProduto() #3 {main} thrown in /var/inc/bibliotecas/PSWebServiceLibrary.php on line 91 Here my code: $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $id_product = '1335'; $precoNovo = "6969"; $xml_product = $webService->get(array('resource' => 'products', 'id' => $id_product)); $resources_product = $xml_product->children()->children(); unset($resources_product->price); $resources_product->price=$precoNovo; $opt = array('resource' => 'products'); $opt['putXml'] = $xml_product->asXML(); $opt['id'] = $id_product; $xml=$webService->edit($opt); } Edited August 1, 2017 by alan.rodrigues (see edit history) Link to comment Share on other sites More sharing options...
El Severo Posted April 9, 2019 Share Posted April 9, 2019 By any chance have you solved this? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now