Jump to content

Adding Products in Prestashop 1.5.5 via Web-Services


UnaLogica

Recommended Posts

Hello, this is my first topic here.

i know it's a question that has been already asked a lot of times but even with the search function and reading some guides i can't resolve the problem.

I'm tring to add a product via web-service using some samples founded here in the forum but i still get an error: 

 

The code is this one: 

 

$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$opt = array('resource' => 'products');
$xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/products?schema=synopsis'));
$resources = $xml->children()->children();
 
unset($resources->position_in_category);
unset($resources->manufacturer_name);
 
$resources->price = '1000';
$resources->active = '1';
$resources->quantity = '50';
$resources->link_rewrite = 'blabla';
$resources->name = 'blabla';
 
$description='<b>ceci est un nouveau test en gras</b>';
$node= dom_import_simplexml($resources->description->language[0][0]);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($description));
 
$resources->description_short = 'blabla';
$resources->associations = '';
 
$opt = array('resource' => 'products');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);
 
thanks in advance
 
Link to comment
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...