1

I have nearly 40k products and all images have been set to small only. If I go into the backend and then set each image one by one to the base, it will take me forever. Is there any way to do it via the database?

  • You want to set small image which is already set in base image? – Rohan Hapani Nov 23 '18 at 12:23
  • I want to set a base image which is already set in the small image. – Akash Nov 23 '18 at 12:52
2

If you want to do by MySQL way follow below way

First, run below query to know the query is actually working and you will get a list of images

select  ev.value, mg.value from catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
WHERE  mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1; 

After that run below query to update small image path with a thumbnail image

UPDATE catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
SET ev.value = mg.value
WHERE  mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1; 

You should run first in test ENV, after making sure you can run on other ENV.

Hope It will solve your issue

0

You can use the CSV. Please add two more column 'base_image' and 'thumbnail_image' in the csv file and re import all the products.Then after reindex the process.

  • Image Url does not generate When I import via CSV file.I have done this – Akash Nov 23 '18 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.