Globally set the un-exclude checkbox for the image gallery on all products in Magento

After time Magento websites tend to get out of sync with some products having excluded images from the product gallery that should be un-excluded and visa-versa– this gives an inconsistent user experience i.e. if the main image is excluded the user can only get to see it again (post the user click a gallery image) by refreshing the page – that’s poor user experience.

A quick fix is to use PHPmyadmin to globally un-exclude all the images:

UPDATE`catalog_product_entity_media_gallery_value` SET `disabled` = '0' WHERE `disabled` = '1';

Please note if you have any undesirable images that are excluded rather that deleted such as old versions this will show them on the frontend.

Just for the sake of being complete, here is the function for excluding all the images:

UPDATE`catalog_product_entity_media_gallery_value` SET `disabled` = '1' WHERE `disabled` = '0';

Now un-excluding all images from the gallery will have 1 noticeable undesirable effect, which is any products that have only 1 image in the list will now have that image in the main window as well as in the gallery. That’s just rubbish so I have a second fix for that:

Go to your media.phtml file template/catalog/product/view/media.phtml

Find this line:

<?php if (count($this->getGalleryImages()) > 0): ?>

Change it to:

<?php if (count($this->getGalleryImages()) > 1): ?>

That will only show the product image gallery when there is more that 1 image.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

WordPress: How to hide the visual composer activation nag

Next Post

Unknown cipher in list: TLSv1 [duplicate]

Related Posts