Jump to content

Recommended Posts


I try to update a product with the webservice but no way, always got : 400 Bad request.
On customer i have no problem, it's only on products.
My Prestashop is a new install, version 1.7.

I use https://github.com/PrestaShop/PrestaShop-webservice-lib for an easy way.

There is my code :

define('DEBUG', true);
define('PS_SHOP_PATH', 'http://prestashopdomain.com');
define('PS_WS_AUTH_KEY', '8XKBE7ZK3ZSRExxxxxxxxxQLR2MXF');

$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);

$opt = array('resource' => 'products');
$opt['id'] = '1';
$xml = $webService->get($opt);
$resources = $xml->children()->children();
$resources->reference = 'demo_3b';
$opt = array('resource' => 'products');
$opt['putXml'] = $xml->asXML();
$opt['id'] = '1';
try {
} catch (PrestaShopWebserviceException $ex)
	echo $ex->getMessage();

As you see, nothing particular...

Can somebody help me ? Thanks :-)

Share this post

Link to post
Share on other sites

Can somebody save me
Let your warm hands break right through and
Save me
I don't care how you do it
Just stay, stay
Oh come on
I've been waiting for you


A little humor in my despair...

Share this post

Link to post
Share on other sites

Hi Echomeme,

you need to remove some data from your schema before update request

  unset($xml->children()->children()->manufacturer_name);         //mandatory            
  unset($xml->children()->children()->quantity);                  //mandatory

because this values are read only.

PS: better to write one function to get product xml

and another to update product

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More