joalex123 Posted December 19, 2016 Share Posted December 19, 2016 Hello, hope you can guide me; my code is: <?php function make_product_options($data){ global $webService, $config; /*try{*/ $xml = $webService->get(array('url' => $config["ps_shop"].'api/product_option_values?schema=blank')); $product_option_value = $xml->children()->children(); $product_option_value->id = 1; $product_option_value->id_attribute_group = $data["id_attribute_group"]; $product_option_value->name->language[0][0] = $data["name"]; $product_option_value->name->language[0][0]['id'] = 1; $opt = array('resource' => 'product_option_values'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); var_dump($xml); die(); $product_option_value = $xml->product_option_values; /*} catch (PrestaShopWebserviceException $e){ return; }*/ //insert stock return $product->id; } but i am getting "400 bad request" the xml sended is: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <product_option_value> <id>1</id> <id_attribute_group>4</id_attribute_group> <color/> <position/> <name><language id="1">Logo Grande</language></name> </product_option_value> </prestashop> Thanks!! PD: Any guide to next step is grateful too! (add combination part) Link to comment Share on other sites More sharing options...
joalex123 Posted December 19, 2016 Author Share Posted December 19, 2016 i already solve it, posting the code to help other people! https://gist.github.com/is-just-me/4dadabf7e5514dcc25cf7de51eac9d21 2 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