Free upgrade to Magento 2 supported version
0 votes

How to Mass Exclude/ Unexclude Images from Gallery in Magento

Adding images to Magento products, all pictures get to the gallery - ‘More Views’ lightbox under a main image. There are included images marked as base, small and thumbnail and other additional pictures you added. They are visible at product page, unless you’ve checked ‘Exclude’ option.



Why to Exclude Images from Magento Gallery?

Imagine the situation - you have added a few images to item and marked 3 of them as small, base and thumbnail. Normally base image is already shown as main picture there, so often people do not want this image appear twice on product detail page.


You might also have different images if product comes in various colours. When some of color variation becomes out of stock you may need to exclude its picture from the gallery as well.



The reasons to exclude images might be numerous, though when you need to do this for bulks of goods it can be really time-consuming and tiring talk.


How to Check/ Uncheck Exclude Images Option Massively via Import?

To automate this process you can simply run some query if you have enough of tech skills or use extension like - Store Manager for Magento that extends the possibilities of default Magento admin and makes possible to do the things you thought impossible in Magento.


Try Store Manager for Magento to mass exclude/unexclude images!Download FREE


Here are a few simple steps to follow:

    1. Export

    Run Import Wizard of Store Manager for Magento and select what fields you want to be exported to CSV. Basically you need only the following fields:

    • SKU
    • Media Gallery
    • Media Gallery Exclude


    There is no need to export all the fields, since Store Manager allows you to select what exactly info you need to be exported. At the step ‘Select Fields to Export’ on the left you see available fields with data. Drag necessary ones from the left and drop to the right pane of the window. You can also use buttons in the middle to add fields to be included in CSV.


    2. Edit File

    (optional if you are using expressions)

    Open the file in any spreadsheet editor like OpenOffice.


    In column ‘Media Gallery Exclude’ you will see numbers: 1 means that Exclude box is checked for the appropriate image (you can check what exactly in column Media Gallery containing images); 0 indicates that image is not excluded from gallery and visible at clients’ side.



    If you want to exclude images - put 1, to make images unexcluded - 0.


    Want to automate the process and skip this step as you have got a multitude of images and goods? Keep reading and you will find out how to use expressions during import for on-the-fly changes.


    3. Import to Magento

    In case your import file contains necessary modifications mentioned in point 2, you can simply run Import Wizard of Store Manager for Magento upload file to apply changes.

    Detailed step-by-step Magento import tutorial you can read here -

    https://www.mag-manager.com/useful-articles/magento-product-management/magento-import-products/

    Important images settings during import:

    If you are updating existing images, in additional settings you need to have ‘Import Images’ box unchecked and ‘Clear Image Gallery’ option ticked as on the screen-capture below:



    If you would like to speed up the process and avoid manual work with file, with Store Manager for Magento you can use special expressions ( SQL statement and calculations similar to ones that are used in Excel).


    Expressions during import can be set at the step where you map CSV columns to database fields.



    If you use exported file and didn’t change heading names, your columns were mapped automatically. If yes, un-assign column ‘Media Gallery Exclude’.


    To uncheck Exclude box for all the images and all the product SKUs in file, in tab Expression put the following formula:


    REPLACE ([CSV_COL(x)],1,0)

    Instead X put number of column where in your file you have data from images to be excluded (in our case it is number 3).



    To check Exclude option massively for all the images assigned to products in file, use this expression:


    REPLACE ([CSV_COL(x)],0,1)

    Again instead of X you need to put column name as in example above. This will replace all zeros with 1 and this way check Exclude box.


    Please note: this expression will implement changes to all the images belonging to products you have in file.

    If you need more complex modifications to be performed during import with the help of expressions contact our support via contact@mag-manager.com


    Mass check or uncheck Exclude button for your images without coding!Download FREE


    Related Articles: