How to change sort order of your Magento 2 images using import
Every store owner is his boss. He or she decides how to organize categories, products, Magento images, and other data to convert more visitors to customers. Making the updates manually takes a lot of time especially if you manage a store with big data-sets. Hence, people are often enquiring on forums about how to sort the information in Magento store programmatically.
In this article, we will explain how to solve one of such sorting tasks. You will learn how to change the order of pictures placement via Magento 2 image upload procedure.
In Magento, you can add several images to a product media gallery. If you specify the position of each image on the back-end, they will be displayed on the storefront accordingly. The image with position “0” will be the first one, so indicating values larger than 0, you will put images to lesser positions.
Native Magento admin panel does not include the functionality to change the positions of images massively. So you will have to do it manually for every product.
If you want to avoid this tedious task you need to find an alternative solution. People with technical skills can use coding for the mentioned purpose. However, you have to be 100% sure about your actions. Any incorrect movement 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 are non-experts in SQL and PHP might need other solutions. That is where Store Manager comes in handy.
Store Manager for Magento is a desktop application that simplifies the administration of the Magento store. Using its Import/Export tool you can massively change positions of previously added images. Here is how it works.
Steps to Change Images Position in Magento 2 With Store Manager via Import
1.Prepare the file for import
For the update to run smoothly from the very beginning, we recommend you to follow these steps:
- export the file with the necessary columns using Store Manager Import/Export Wizard,
- add or change media gallery position,
- import the file back.
To update picture position in a gallery, it’s enough to export a file with three columns: SKU, Media Gallery and Media Gallery Position.
Here is an example of the file with these three columns exported from Store Manager:
The first column contains a product SKU. Columns “Media Gallery” and “Media Gallery Position” indicate names and positions of images separated by a delimiter.
To show you how the import works we’ve changed the original positions of the images to the following:
/t/0/toycar3.jpg — position 0
/t/o/toycar2.jpg — position 1
/t/o/toycar1.jpg — position 2
That means that after the import, store visitors will see the images in this order:
/t/0/toycar3.jpg - first
/t/o/toycar2.jpg - second
/t/o/toycar1.jpg - third
2. Import the file using Store Manager Import/Export Products Wizard
You can easily import the file with the Import/Export Products tool. Launch the Wizard and follow the instructions:
On step 4, pay attention to the “Images” section. As your import file contains the info about the images that had been added to your store before you don’t have to upload them again. So you can leave the tickboxes unchecked and press "Next" to proceed with the upload:
On the final step, choose “Modify only” in the “Import Methods” list and hit “Import”:
Images positions have been successfully changed on the backend:
Now let’s check them on the storefront. As you can see, all the images were put to the specified positions:
Sort Magento Gallery Images in the Way You Like! Try FREE Now!
You can find a step-by-step tutorial on how to import data here - Magento 2 Product Import Guide
What to Check if You Cannot Upload Magento Images?
List of reasons causing the impossibility to import Magento images (cache, reindex, image size etc). Read More...
Upload Magento Swatch Images to Configurable Products
Get the full explanation of Magento swatch images and their purpuses and find out the ways to assign them to products via admin and Store Manager. Read More...