yairobe Posted December 3, 2020 Share Posted December 3, 2020 After import all products with one image don't show me image in product list at backend. How can I set all first image to be cover image? Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2020 Share Posted December 3, 2020 Please, as you imported the images, what is the exact version of Prestashop. Thank you Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2020 Share Posted December 3, 2020 Do you need an SQL script that sets the first image of the product? Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2020 Share Posted December 3, 2020 Has image thumbnail regeneration been set up? Link to comment Share on other sites More sharing options...
yairobe Posted December 3, 2020 Author Share Posted December 3, 2020 hI! 1.7.6.9 I try regeneration, no luck with that. Script will be nice I try this but no luck: UPDATE `ps_image` SET `cover` = NULL UPDATE `ps_image` SET `cover` = 1 WHERE `position` = 1; Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2020 Share Posted December 3, 2020 (edited) Sorry. I'm not at the computer today, I'll write tomorrow. Edited December 3, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
yairobe Posted December 4, 2020 Author Share Posted December 4, 2020 Maybe somebody have php/js script I waiting for reply Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2020 Share Posted December 4, 2020 Hi, You had SQL well, you just didn't put a semicolon at the end of the first line. UPDATE `ps_image` SET `cover` = NULL; UPDATE `ps_image` SET `cover` = 1 WHERE `position` = 1; Link to comment Share on other sites More sharing options...
yairobe Posted December 4, 2020 Author Share Posted December 4, 2020 Thank for help, 5 min ago i do that And magic works when i delete cache Link to comment Share on other sites More sharing options...
bibob Posted November 21, 2021 Share Posted November 21, 2021 This may not work in case `position` 1 is not set for images in my case i have 4 images for a product which only have position 4,5,6 and 7 the best solution to quickly fix all missing cover value is to run UPDATE IGNORE ps_image f set f.cover = 1 where f.id_image = (SELECT t1.id_image FROM ps_image t1 JOIN ( SELECT MIN(id_image) AS min_value, id_product FROM ps_image GROUP BY id_product ) AS t2 ON t1.id_product = t2.id_product AND t1.id_image = t2.min_value where t1.id_product = f.id_product limit 1); UPDATE IGNORE ps_image_shop f set f.cover = 1 where f.id_image = (SELECT t1.id_image FROM ps_image_shop t1 JOIN ( SELECT MIN(id_image) AS min_value, id_product FROM ps_image_shop GROUP BY id_product ) AS t2 ON t1.id_product = t2.id_product AND t1.id_image = t2.min_value where t1.id_product = f.id_product limit 1); in case you will set the cover image according to the image with lowest position number, just change MIN(id_image) with MIN(position) , but the query i provided will just set the cover image for the first uploaded image which ahve the lowest image id 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