Jorr.it Posted March 20, 2021 Share Posted March 20, 2021 When I would try to upload (add) new images to an existing product having existing images using the API, it will return an error: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![CDATA[97]]></code> <message><![CDATA[[SQL Error] Duplicate entry '16-1' for key 'id_product_cover'. From DbCore->insert() Query was : INSERT INTO `ps_image` (`id_product`, `position`, `cover`) VALUES ('16', '6', '1')]]></message> </error> <error> <code><![CDATA[97]]></code> <message><![CDATA[[SQL Error] Duplicate entry '16-1' for key 'id_product_cover'. From ObjectModelCore->add() Query was : INSERT INTO `ps_image` (`id_product`, `position`, `cover`) VALUES ('16', '6', '1')]]></message> </error> <error> <code><![CDATA[76]]></code> <message><![CDATA[Error while creating image]]></message> </error> </errors> </prestashop> It sounds fair that a product can only use one image at a time as a cover. The problem is that I don't see any possibility in the API to manage which image will become the product cover. To upload product images, I use exactly the PHP code as suggested in the PrestaShop webservice tutorial: https://devdocs.prestashop.com/1.7/webservice/tutorials/advanced-use/image-management/#using-curl Using PrestaShop 1.7.6.4. Could this be a bug? Or am I doing anything wrong? Link to comment Share on other sites More sharing options...
Jorr.it Posted March 24, 2021 Author Share Posted March 24, 2021 Anyone? Please help me out and let me know if could or should do something different with my post. Or just be patient? Link to comment Share on other sites More sharing options...
Jorr.it Posted March 25, 2021 Author Share Posted March 25, 2021 I posted this problem as an issue on GitHub: https://github.com/PrestaShop/PrestaShop/issues/23777 In the issue you can find PHP code to reproduce. 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