Introduction
You can import default image of a product with CSV import but you cannot import the cover image. For exemple, it is very important to select a good bunch of images of products with different colors. If you sell T-shirts and all the cover images show white T-shirts your webshop will lack of identity.
The easiest way is to import the default image and use a SQL request to set the same cover image than the default image.
Process
- So first of all, you need to have set all the default image in your catalog. you can do this automatically by importing a CSV file.
- Open your database (for example by phpMyAdmin)
- Create backup of your database for safety (export data and structure)
- Open SQL tab and perform queries from this file (change ‘ps_’ to your prefix):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
UPDATE ps_image SET cover = NULL; UPDATE ps_image_shop SET cover = NULL; UPDATE IGNORE ps_image SET cover = 1 WHERE ps_image.id_image IN ( SELECT ps_product_attribute_image.id_image FROM ps_product_attribute INNER JOIN ps_product_attribute_image ON ps_product_attribute.id_product_attribute = ps_product_attribute_image.id_product_attribute AND ps_product_attribute.default_on = 1 ); UPDATE IGNORE ps_image_shop SET cover = 1 WHERE ps_image_shop.id_image IN ( SELECT ps_product_attribute_image.id_image FROM ps_product_attribute INNER JOIN ps_product_attribute_image ON ps_product_attribute.id_product_attribute = ps_product_attribute_image.id_product_attribute AND ps_product_attribute.default_on = 1 ); UPDATE IGNORE `ps_image` SET `cover` = 1; UPDATE IGNORE `ps_image_shop` SET `cover` = 1; |
5. It is done, the cover images will match the default images!
3 commentaires
hrcv · 10 novembre 2020 à 17 h 08 min
How can this be done in a Multi-Shop Scenario?
admin · 13 novembre 2020 à 14 h 50 min
Hello, thank you for your comment 🙂
It works with Multi-Shop, I already use it with three shops instances.
Regards,
[Update 2021] Guide Ultime d’Installation d’une Boutique Prestashop 1.7 – Importation, Store Commander, Akeneo PIM, Importation entre deux PrestaShop – Partie 3 - Metrodyn · 14 décembre 2021 à 20 h 32 min
[…] Voir l’article pour remplacer les images de couverture par les images par défaut […]