Orienteed logo verde y blanco
Go to blog

From Magento 1 to Magento 2: How to successfully migrate your ecommerce

by David Casal, 8/19/2020, 12:00:00 AM

We can divide the migration mainly into 4 steps:

  • Installation of Magento 2 on our server
  • Migration of our db source to our db target
  • Installation and configuration of our theme and extensions
  • Migration of our media folder to the target environment


Installation of Magento 2 on our server

The first step to proceed with the installation of Magento 2 in our server is the installation of the "Composer" tool, a tool that will be key to us when installing Magento 2 as well as when installing the extensions that we need to use. 

To install Composer we simply need to launch a command, this command varies depending on the operating system we are using.

Translated with www.DeepL.com/Translator (free version)

For UNIX:

De Magento1 a magento2

For Windows:

De Magento1 a Magento2


Once we have installed the tool it is recommended to move it to a global path that facilitates its invocation when necessary, to move it to our new path we can use the following command:

De Magento1 a Magento2


Now that we have installed the tool for the software installation, we can proceed to download Magento 2. In order to do that we simply have to launch the following command:

 “composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .”

Once the download is completed, we must set the correct permission level in the Magento 2 installation directory. The official Magento documentation recommends using 700 for directories and 600 for files. We can set the two different permission levels using the following command:

De Magento1 a Magento2

The next step would be to create the database that we will use as the destination for the migration. In our case we will use an existing database and a prefix during the installation process.

Now that we have downloaded Magento 2, we can choose two ways to perform the installation. 

The first one is to navigate to the host where we have installed Magento 2 and if everything worked correctly, we should be redirected to the setup tool. 

We can also use another option, which is the one that we will use in our case and that would consist of using the command for setup and installation, along with a series of parameters that should be configured according to our database and other parameters related to the information of our store.

 

De Magento1 a Magento2

Migration of our db source to our db target


In this step we will see how to migrate all the information from our source bd (catalog, inventory, orders, etc) to our destination bd.

To perform this operation we will have to connect through SSH to our server where we have installed Magento 2 and move to our installation directory.

Once we have moved to the Magento 2 installation directory, we will use the following command to install the data migration tool

"composer require magento/data-migration-tool: 2.3.5" 

(Replace 2.3.5 with your Magento 2 version)

If the installation was successful, the console will display a message like this:


De Magento1 a Magento2

With the data migration tool already installed, we should navigate to the following directory:

vendor/magento/data-migration-tool/etc/opensource-to-opensource/<magento1_version>(In our case: 1.9.3.9) 

Once there, we will duplicate the config.xml.dist file and rename it to config.xml .

Then, we will edit the file that we have just duplicated (config.xml) and we will configure the access data for our source and destination db.


De Magento1 a Magento2

Further down in the same file, we'll add our crypt key (which we can find in the Magento 1 installation directory → appetc/local.xml) to the <cript_key> tag.

Once we're done, we'll need to navigate to the next folder:

vendor/magento/data-migration-tool/etc/opensource-to-opensource/

There we will duplicate the file settings.xml.dist to settings.xml and copy the latter to the next directory: 

vendor/magento/data-migration-tool/etc/opensource-opensource/<magento1_version>(In our case: 1.9.3.9) 

When we have copied the file, we must edit the file:

vendor/magento/data-migration-tool/etc/opensource-to-opensource/<magento1_version>/config.xml 

And change the value of the label <settings_map_file> with the path of the settings.xml file that we have just copied.

Then, we should go to the next directory:

vendor/magento/data-migration-tool/etc/opensource-to-opensource/<magento1_version>. 

There we will duplicate and rename the file map.xml.dist to map.xml .

With this ready, we will return to edit the file config.xml that we will find inside vendor/magento/data-migration-tool/etc/opensource-to-opensource/<magento1_version>. 

and update the value of the <map_file> label with the path to the map.xml file we just created.

With all the configuration part ready, we'll go back to the Magento 2 installation directory and launch the following command:

php bin/magento migrate:data "vendor/magento/data-migration-tool/etc/opensource-to-opensource/<magento1_version>/config.xml" --reset -auto

In our case, the command would be as follows:

php bin/magento migrate:data "vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.3.9/config.xml" --reset -auto


If everything went well, the console should display a message similar to the following:

De Magento1 a Magento2

Finally, we should launch a reindex in order to display all the data related to the catalogue on our site.


De magento1 a Magento2


Installation and configuration of our theme and extensions

The installation of our theme/extensions in Magento 2 consists of a series of simple steps.

The first one is to search and buy the theme or extension we want to install in our Magento from the Magento Marketplace itself (https://marketplace.magento.com/). 

Once you have bought your theme/extension you must go to "My Profile" window → Follow the link "My purchases" → Click on the "Technical details" of our extension and copy the values of "Component name" and "Component version".


De Magento1 a Magento2

Then we will start a SSH session in the server where we have installed Magento 2 and we will navigate to the installation directory of the same.

Once there, we will launch the following command:

composer require <component_name>:<component_version> . 

In our case: composer require meetanshi/magento2-cookie-notice:1.0.2 .

Finally we will launch these three commands (The first one to update our setup and the next two to clean the cache):

php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento cache:flush

Once all the commands have been executed, we can return to the Magento administration panel and configure the extension at Stores→Settings→Configuration

De Magento1 a Magento2

In the case that what we have installed has been a theme, the process would be practically the same with the peculiarity that we probably need to copy the stylesheets that we had used in our Magento 1 to the Magento 2 directory that is indicated in the extension itself. 

Although in the case of being an Emthemes theme we can edit the styles directly in the Custom CSS section, without having to copy them from one environment to another.


De Magento1 a Magento2

Migration of our media folder to the target environment


The last step, which concludes the Magento migration, is the migration of our media folder to our destination environment.

The media folder is, as its name indicates, where we store all the store's media (product images, banners, logos, etc).

As we can imagine it is a very heavy folder which makes the biggest difficulty of its migration reside in the download/upload times. 

Although the copy process is very simple since it simply consists of copying the media folder from the Magento 1 installation directory to the pub/media directory that we will find inside the Magento 2 installation directory.

Once the copy process is finished, we must launch the following commands:

php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush

This would finish the migration of our website to the latest version of Magento.

Related posts

Join our mailing list

Want to know more about e-commerce trends, industry articles and events? Subscribe now to our monthly newsletter!

We use cookies to improve your experience and our services by analyzing your navigation on our website. If you continue to browse, we consider that you accept its use. You can learn more by clicking here:
Cookies Policy
Logotipo de Orienteed

Cookies Policy

A cookie is a small text file that is downloaded to your computer when you access certain web pages. Cookies allow web pages, among other things, to store and retrieve information about the device or browsing habits of a user. Depending on the information retrieved, cookies can be used to recognize the user.
Technical Cookies are essential to provide the service offered and requested by a user, to remember configuration preferences, as well as for security and fraud prevention purposes. The website cannot function properly without these cookies.
Analytical cookies help us analyze the activity of users and the number of visitors on the website. They allow the collection of information on the number of visitors, their origin, the browser used, the duration spent on each page, the impact of ads, etc. These cookies are used exclusively for statistical purposes and do not allow identification of particular individuals.

How to deny or revoke cookie consent

Cookies can be blocked or deleted through the browser settings. The following links detail how to do it in each of the most used browsers.