How to Change Sort Order of Your Magento Images Using Import?

Date: June 18, 2013

Managing Magento online store each store owner is his own boss who decides where the data are placed and how they will be reflected at the front-end. This concerns not only products and categories, but basically all the data available at your e-shop, including Magento images.


There is huge amount of different forum posts where people are enquiring how is it possible to sort out the information programmatically. It is especially relevant for the stores with huge data-sets for which manual modifications mean too much work.


Today we will explain you how to change the order of pictures placement via Magento image upload procedure.

Generally, all the pictures you add for your product are placed to Image gallery. Magento allows you to manually set the order in which images will appear at the front-end at your store. Image with position “0” will be top-image, so indicating values larger than 0, you will put images to lesser positions.

However, as was mentioned above, often it is too tedious to indicate position of each image for one product after another. Since generic Magento itself does not include the possibility to massively handle this task out-of-the-box, the people with special technical skills can use coding for the mentioned purpose. However, you have to be 100% sure in your actions, since any incorrect move like pasting the piece of code to the wrong place or commenting out some lines can be damaging for the whole store.


Those who care about safety and non-experts in SQL and PHP might need other means of accomplishing the task. Store Manager for Magento is easy-to-install desktop solution using which you can carry out Magento image upload importing pictures along with their position indicated in the file or images change sort order massively.


First of all, you need to make sure that position is correctly inputted in your import file for the information to be properly applied. In case you are uploading product images together with products, check if you have all the required fields and also “Media Gallery” “Media Gallery Position” (database field name - media_gallery_position). For updating Magento images position, there is no need to include of of the columns, as it slows down the process of import. With Store Manager you can use only 3 rows: SKU, Media Gallery and Media Gallery Position.
In the column ‘Media Gallery’ there should be indicated image names or image paths separated by delimiter symbol (comma, semicolon or any other) and the column ‘Media Gallery Position’ the numbers that correspond to position of images in the gallery should be indicated (also separated by delimiter).

Take a look at this example:

There you see that for image1 was indicated position 1, for image2 - 2 and for image3 - 0. It means that after import, the images will be organized in this order: image3 will be the first, image1 will be following it and the last one will be seen image2.

The same way you can import remote Magento images, indicating their position. For that you need to indicate image URLs and their sort order.

You are free to modify the position of images in the file and the changes will be reflected at the front-end after Magento image upload.


Further import procedure is accomplished easily using Import/Export Wizard of Store Manager for Magento. Do not forget to click the checkbox ‘Import Images’ and assign the columns of the .csv file to database fields.

Step-by-step tutorial on how to import data using Store Manager for Magento you can read here -

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

By Maria Kvasnytska