mediacompresser Posted 6 hours ago Share Posted 6 hours ago Hi PrestaShop Community, I'm developing an external app that integrates with PrestaShop 8.2.3 via WebService API to replace product images while maintaining the original position in the image gallery (e.g., replace image at position 3 without it going to the end). Current Setup: - PrestaShop version: 8.2.3 (localhost XAMPP setup). - API key with full permissions for products (GET/PUT) and images (GET/POST/DELETE). - Example: Product ID 2 has images [2, 30, 33, 36, 37, 38, 39, 40]. I want to replace ID 33 (position 3) with a new image (ID 41). What I've Tried (based on docs and forums): 1. DELETE /images/products/2/33 (success, HTTP 200). 2. POST /images/products/2 (new image ID 41 uploaded, but at last position). 3. PUT /products/2 with minimal XML including <associations><images> in desired order (e.g., <image><id>2</id></image><image><id>30</id></image><image><id>41</id></image>...), id, price, name, id_category_default. - Response: HTTP 200, but position ignored—new image still at end (order: 2, 30, 36, 37, 38, 39, 40, 41). 4. Retries with sleep(10) and re-fetch image list before PUT—still fails. 5. Full re-upload method (delete all, re-upload in order)—works but wasteful for bandwidth/time (app for multiple users). Question: Is there a way to update ps_image.position via API without re-uploading all images? (e.g., direct PUT on image resource or hidden param in associations/images?) Why is associations/images order ignored for new images? Any bug in 8.2.3? Any workaround (e.g., custom header, schema=blank, or override without DB access)? Similar thread: https://www.prestashop.com/forums/topic/1041234-update-product-images-position-and-not-image-via-webservice-api/ (from 2022, no resolution). Thanks for any help/suggestions! Code snippets or XML examples appreciated. 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