Organize Product Imges in Magento
set default base, thumb, small image to first image. If you have multiple images per product from your import, Magento might have set the LAST one as the default base, small, and thumb image for all of your products! This can be an issue if you want the FIRST image to be the default! SQl given below updates your images and makes the FIRST image (order 1) your default BASE, SMALL, and THUMB image for ALL products in your database. [sql] 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 mg.entity_id = ev.entity_id AND ev.attribute_id IN (70, 71, 72) AND mgv.position = 1; [/sql] Auto
enable thumbs for multi image and auto disable for single image products. If you’re like me, you want the multi-image products to have thumbnails enabled on the product page, and if you only have 1 image. Step1 : The first enables all images for thumbnails [sql] UPDATE catalog_product_entity_media_gallery_value SET disabled = 0; [/sql] Step2: Then the second disables any thumbnails for images associated to products having only a total count of image. [sql] UPDATE catalog_product_entity_media_gallery_value AS mgv, (SELECT entity_id, COUNT(*) as image_count, MAX(value_id) AS value_id FROM catalog_product_entity_media_gallery AS mg GROUP BY entity_id HAVING image_count = 1) AS mg SET mgv.disabled = 1 WHERE mgv.value_id = mg.value_id [/sql]
Hi,
In version 1.6. you would need to change the _id value:
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 mg.entity_id = ev.entity_id
AND ev.attribute_id IN (79, 80, 81)
AND mgv.position = 1;
and it works.
Hello
Does this change (79,80,81) works for magento 1.5.0.1 also?
new attribute_id in version 1.8
85 – base image
86 – small image
87 – tumb
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 mg.entity_id = ev.entity_id AND ev.attribute_id IN (85, 86, 87) AND mgv.position = 1