NeedZoom Posted May 27, 2016 Share Posted May 27, 2016 Hi, I want to edit the price of a product with webservice and php.I use this code but not working : This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request. $xml = $webService->get(array('url' => $url.'/api/products?schema=blank')); $productP = $xml->children()->children(); $productP->price = 20; //Prix TTC $productP->wholesale_price = 89; //Prix d'achat $opt2 = array('resource' => 'products'); $opt2['putXml'] = $xml->asXML(); $opt2['id'] = $result;//with $result the id of product $xml = $webService->edit($opt2); Link to comment Share on other sites More sharing options...
NeedZoom Posted May 27, 2016 Author Share Posted May 27, 2016 (edited) I have inspired from this page: https://github.com/PrestaShop/PrestaShop-webservice-lib/blob/master/examples/Update.php this code work with customers but not with products !!!! I have the same error: This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request. Any idea how fixed this PLZ! Edited May 27, 2016 by NeedZoom (see edit history) Link to comment Share on other sites More sharing options...
NeedZoom Posted May 31, 2016 Author Share Posted May 31, 2016 the error i: manufacturer_name" not writable. Please remove this attribute of this XML How can i removed from XML Link to comment Share on other sites More sharing options...
NeedZoom Posted May 31, 2016 Author Share Posted May 31, 2016 solution: unset($resources->manufacturer_name); et unset($resources->quantity); 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