chris112 Posted March 30, 2014 Share Posted March 30, 2014 (edited) I'm trying to create a product on 1.6 web service but I'm getting this error. Anybody know how to fix it? $webService = new PrestaShopWebservice('http://presta.dev:8888', 'IJQ3F3EULJYS1EYSSDBB8EA4Y2K7RHSY', true); $opt = array('resource' => 'products'); $xml = $webService->get(array('url' => 'http://presta.dev:8888/api/products?schema=blank')); $resources = $xml->children()->children(); unset($resources->position_in_category); unset($resources->manufacturer_name); $resources->price = '1000'; $resources->active = '1'; $resources->link_rewrite = 'test-rewrite'; $resources->name = 'test name'; $resources->description = 'test description'; $resources->description_short = 'test short description'; $resources->associations = ''; $opt = array('resource' => 'products'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); XML SENT xml=<?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <product> <id/> <id_manufacturer/> <id_supplier/> <id_category_default/> <new/> <cache_default_attribute/> <id_default_image/> <id_default_combination/> <id_tax_rules_group/> <type/> <id_shop_default/> <reference/> <supplier_reference/> <location/> <width/> <height/> <depth/> <weight/> <quantity_discount/> <ean13/> <upc/> <cache_is_pack/> <cache_has_attachments/> <is_virtual/> <on_sale/> <online_only/> <ecotax/> <minimal_quantity/> <price>1000</price> <wholesale_price/> <unity/> <unit_price_ratio/> <additional_shipping_cost/> <customizable/> <text_fields/> <uploadable_files/> <active>1</active> <redirect_type/> <id_product_redirected/> <available_for_order/> <available_date/> <condition/> <show_price/> <indexed/> <visibility/> <advanced_stock_management/> <date_add/> <date_upd/> <meta_description><language id="1"/><language id="2"/></meta_description> <meta_keywords><language id="1"/><language id="2"/></meta_keywords> <meta_title><language id="1"/><language id="2"/></meta_title> <link_rewrite>test-rewrite</link_rewrite> <name>test name</name> <description>test description</description> <description_short>test short description</description_short> <available_now><language id="1"/><language id="2"/></available_now> <available_later><language id="1"/><language id="2"/></available_later> <associations></associations> </product> </prestashop> RETURN HTTP BODY <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![CDATA[84]]></code> <message><![CDATA[Validation error: "Property Product->link_rewrite is empty"]]></message> </error> </errors> </prestashop> Edited March 30, 2014 by chris112 (see edit history) 1 Link to comment Share on other sites More sharing options...
molesto Posted June 24, 2014 Share Posted June 24, 2014 I'm having the same problem, I try to set the ws_modifier like this: $resources->link_rewrite['ws_modifier'] = "modifier"; but doesn't work, any idea? Link to comment Share on other sites More sharing options...
Daniel Patilea Posted November 6, 2015 Share Posted November 6, 2015 Anyone found a solution for this? Link to comment Share on other sites More sharing options...
Mythril Posted May 13, 2016 Share Posted May 13, 2016 When I look at the schema synopsis, link_rewrite has a language node child. I'm guessing that is what is confusing the API endpoint. Link to comment Share on other sites More sharing options...
Recommended Posts