Magento 1 End of life: How to migrate Magento 2 exactly

07 May 2020
If you are planning to migrate from Magento 1 to Magento 2 for your store. Oh! This post for you. Here is what things you need to know in order to migrate this process.

Magento 1 End of life: How to migrate Magento 2 exactly

As you know, Magento recently announced that all versions of Magento 1 would become end of life on June, 30 upcoming. This means that quality fixes or security patches won’t be deployed for Magento 1 after the deadline. So, retailers whose Magento 1’s website will face security-related issues. Otherwise, Magento 2 platform brings better experiences than the predecessor for the user. It has a lot of features and offers a host of benefits. It supports PHP7, full-page cache by default… and also improves indexers and database optimizations so Magento 2 platform deserves recognition in the eCommerce. 

If you are planning to migrate from Magento 1 to Magento 2 for your store. Oh! This post for you. Here is what things you need to know in order to migrate this process.

Nevertheless, this process may run up against some problems so before you carry out it, let’s take note of somethings to avoid losing data or the same else.

   - Have you determined if Magento 2 versions of your extension exit?

   - Backup your Magento 1 store with the database

   - Analyze the store and keep what you consider necessary and delete the rest.

   - Check the compatibility of current theme, extension, and custom code with Magento 2.

According to the document of migrating official Magento, this process is divided into 4 stages:

  1. Theme migration 

  2. Extension migration

  3. Customization migration 

  4. Data migration

Theme migration

Magento 1 theme migration isn’t able to migrate directly to Magento 2 however you can create a new theme or install one of them from the Market place because it can inherit from the default or any other existing one. See here

Extension migration

The extension Magento 2 can’t be compatible with Magento 2 so let’s install useful Magento 2 extension for your store. 

Customization migration

There are many ways that your store will be running on custom code so you should migrate custom code thoroughly and you can use the Code migrate toolkit to make this easier process.

Data migration

This step will include data migration of customers, products, store configurations, promotions, and more to Magento 2. The store data is important so you can’t lose them so you can take the assistance of the Magento 2 data migration tool which helps you migrate the database of Magento 1 to Magento 2 easily.

 After migrating, you need to test the Magento 2 store’s functionality thoroughly., perform the following task: 

   - Put Magento 1 in maintenance mode and permanently stop all Admin activities

   - Start Magento 2 cron jobs

   - Flush all Magento 2 cache types

   - Reindex all Magento 2 indexers

   - Change DNS, load balancers, etc. to point to Magento 2 production hardware.

Firstly, let’s see the installation and configuration of the Magento 2 Data Migration Tool.

Install data migration tool.

 Before installing, remember that versions of Magento and Data Migration Tool must match. For example, if you are using Magento version 2.2.0, you have to install the data migration version 2.2.0.

If you don’t know the version of your store, let’s navigate to the root directory of Magento 2 via SSH and enter the following command:

       php bin/magento --version

 There are 2 ways to install Magento 2 data migration: repo.magento.com, GitHub. Installing from repo.mangento.com

Update the location of the Data Migration Tool package in the composer.json file to make it work and then run the below two commands:

composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:<version>

In the above command, <version> refers to the tool version that is the same as that of your Magento 2 version. 

For example, the above commands for Magento version 2.2.0 will look like this:

composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:2.2.0

Now, enter the username, i.e., public key and password, i.e., private key. You can create new keys using Create a New Access Key button.

Installing from GitHub

  - Log in to your Magento server as

  - Change to Magento 2 root directory.

  - Enter the following commands:

composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool
composer require magento/data-migration-tool:<version>


 
where <version> must match the version of the Magento 2 codebase.

That’s all for the installation of Data Migration Tool in the Magento 2 store.

Note: After completing the installation, let’s check version of installed Data migration tool.

   - Change to your Data Migration Tool directory: <vendor>/magento/data-migration-tool. 

   - Open composer.json in a text editor.

   - The version entry in that file is the version of the Data Migration Tool.

Configure Magento 2 Data Migration Tool

After you install the data migration tool, let’s the following directory contains mapping and configuration files:

 <your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource



    - Configuration and scripts for migrating from Magento Open Source 1 to Magento Commerce 2
 

<your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/opensource-to-commerce

 
   
- Configuration and scripts for migrating from Magento Commerce 1 to Magento Commerce 2

<your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/commerce-to-commerce

The above file will contain configuration and scripts for each supported version.

Before, you migrate any settings and data, go to the Magento 2 root folder and find the following directory:

<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version>

Then copy config.xml.dist file to config.xml.

Now open config.xml and then find the code block below:

1
2
3
4
5
6
7
8
9
<source>
   <database host="127.0.0.1" name="magento1" user="root"/>
</source>
<destination>
   <database host="127.0.0.1" name="magento2" user="root"/>
</destination>
<options>
   <crypt_key />
</options>

Here, <source> has the database information of Magento 1 and <destination> has the relevant database information of Magento 2. <crypt_key> is mandatory and needs to be filled prior to run. It is the encryption key of the Magento 1 store and can be found in the <Magento 1 root dir>/app/etc/local.xml file, within the <key> tag.

Finally, save your changes to config.xml and exit the text editor.

Settings Migration

The Settings mode migrates stores, websites, and system configurations like shipping, payment, tax settings, etc. According to our data migration order, you should migrate settings first.

Before migrating settings, so head over to the M2 root folder and run to make sure that you specified the correct path to your config.xml.


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

where <path to your config.xml> would be vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version>/config.xml. I have used –reset argument in the above command which forces the Data Migration Tool to start from the beginning.

The success message is displayed once the settings are over.

Data migration

Now, we are ready to transfer orders, customers, and the actual store data.

To migrate data, following the command:

php bin/magento migrate:data --reset <path to your config.xml>

 This tool will save its current progress but if it occurs, stop the process and fulfill it from the last known good state.

Be careful! This process is quite complicated and requires great attention from professionals because any mistakes are able to result in data loss or improper store functionality. If you are not sure that you can migrate Magento 2 exactly, you should ask for help from experts. Hope this post be useful for you!

 

 

.

 

Related Posts

How to config fixed product taxes (FPT) on Magento 2

How to config fixed product taxes (FPT) on Magento 2

15 Jun 2018
The fixed product tax is applied on product level, based on product. In some jurisdictions, this tax is subject to an additional percentage tax. Your tax authority may also have rules about how your product prices appear to customers, with or without taxes. Make sure you understand the rules, and set your FPT display accordingly.