betox033 Posted December 16, 2019 Share Posted December 16, 2019 I am trying to add a Product to Prestashop using WebService. So far he was able to create the product, assign it to its corresponding category and modify the stock without major problems, however, you will not be able to add an image to the product. I am based on this: https://github.com/xabikip/PrestaShopWebService/blob/master/examples/createProduct.php But I also tested the official documentation:https://devdocs.prestashop.com/1.7/development/webservice/tutorials/change_product_image/ Below is the code: $url = $url . '/api/images/products/' . $id_producto; $image_path = 'http://localhost/webservice/img/caja.jpg'; echo("<br>" . $image_path); echo("<br>" . $url); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_USERPWD, $key.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path.';type=image/jpg')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); Is there any data that I am not taking into account, any data that is wrong? 1 Link to comment Share on other sites More sharing options...
betox033 Posted July 30, 2020 Author Share Posted July 30, 2020 Sorry my friend, it's been a while since I asked the question. I finally opted for another solution for my problem 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