Before we start migration, let’s do some factual analysis that can help us to plan Magento1 to Magento2 migration in the most efficient way.
Magento 2 has a completely different technical architecture than Magento1. The main focus to launch Magento 2 has been to improve performance, security, user experience and efficient backend management.
|Magento 1||Magento 2|
|Web server software||Apache 2.x||Nginx 1.7+, Apache 2.2 or greater|
|PHP framework||Zend Framework 1 (End of life on 28 Sept 2016)||Zend Framework 1 & 2, Composer, PSR 0 to 4, Symfony|
|PHP version||PHP 5.2 to PHP 5.5.x||PHP 5.6+ to PHP 7.0.6|
|Database||MySQL||Varnish 3 or 4.x, Memcached 1.4.x, Redis 2 or 3.x, MySQL, MySQL Percona 5.6+|
So, it’s quite clear from above comparison table of Magento1 and Magento2 that Magento2 is more modern set up.
Magento 2’s core code structure is nearly 90% different than Magento 1.
Migration of Magento 1 website to Magento 2 can’t be simply be done by migrating Magento1 website’s code to Magento2.
The first step is to set up Magento2 on the server that fulfils its technical requirement as per above table. If your existing server ticks all the boxes, you don’t need to change it but if it doesn’t then you will need a new one that supports Magento 2.
After that migrate database of Magento 1 website to the new Magento 2 set up.
List out the extensions used in Magento 1 site. You will need to check whether the same extensions are available for Magento 2 version. If not then you’ll need to find similar extensions compatible with Magento 2 or will have to do custom Magento development to match the functional features.
The front-end theme needs to be built from scratch. Whether you want to keep the same existing design or want a new layout set up, the efforts are going to be same for Magento 2 front end development.
If you have used a theme in Magento 1 website, you will need to check if the same theme is available for Magento 2 version or else you will have to use another theme built for Magento 2.
SSH access from server is crucial for Magento 2 set up. If your existing server doesn’t have it, you will need to ask your host to provide you with one.
Once you are prepared with front end theme files and extensions compatible with Magento 2 and have set up Magento 2 with SSH on the server, follow below steps:
1. Install Magento 2 Data Migration Tools using composer
Inorder to make it work, you will need to update the location of the DataMigration Tool package in the composer.json file and for that, run below two commands:
composer config repositories.magento composer https://repo.magento.comcomposer 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 that you have set up.
To find out exact version of your Magento 2 store, navigate to the root directory of Magento 2 via SSH and enter the following command:
php bin/magento –version
You’ll need to enter your developer authentication keys which can be obtained from Magento website. Go to Magento Marketplace, login using your account details, navigate to your profile and click Access Keys link under My Products section.
Using above details you now start installing Data Migration Tool for Magento 2 using composer
Fire this command
composer config repositories.magento composer https://repo.magento.com composer require magento/data-migration-tool:2.2.0
You now have to configure Magento 2 Data Migration tool by using below steps
The following listed directory files will include configuration and mapping files for the Data Migration Tool.
<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource <Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-commerce <Magento 2 root dir>/vendor/magento/data-migration-tool/etc/commerce-to-commerce
Here opensource means Magento community version and Commerce means Magento Enterprise
You must create a config.xml file in the relevant directory before you migrate any data and settings. So for instance, if you are going to do migration of data from Magento 1 platform to Magento 2 platform, you can navigate to <Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version> directory and rename config.xml.dist to config.xml.
The next step now is to open .xml in a code editor and need specify the following:
<source> <database host="localhost" name="Magento1-DB-name" user="DB-username" password="DB-password"/> </source> <destination> <database host="localhost" name="Magento2-DB-name" user="DB-username" password="DB-password"/> </destination> <options> <crypt_key>Magento1-Encrypted-Key</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 running this. It is the encryption key of Magento 1 store and can be found in <Magento 1 root dir>/app/etc/local.xml file, within the <key> tag.
Lastly, save the config.xml.
2. Migrate Settings Using Magento 2 Data Migration Tool:
As per the best practices for Magento development especially for Data Migration Order, you should first migrate settings.
Navigate to your Magento 2 root directory via SSH and run the following command:
php bin/magento migrate:settings --reset <path to your config.xml>
where<path to your config.xml> would bevendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.xversion>/config.xml. I have used –reset argument in the above command whichforces the Data Migration Tool to start from the beginning.
The success message is displayed once the settings are over.
3.Migrate Data Using Magento 2 Data Migration Tool:
Migration of data from Magento 1 platform to Magento 2 platform includes categories, products, customers, orders , ratings, wish lists etc.
Run the following CLI command to start migrating data of Magento 1 website to Magento 2.
php bin/magento migrate:data --reset <path to your config.xml>
The tool saves its current progress. If an error occurs, it stops the process and resumes from the last known good state.
When I ran it, I got the “Integrity Check failed” message along with a bunch of errors:
Error :[2018-09-18 18:31:18][ERROR]: Foreign key (FK_CATALOG_EAV_ATTRIBUTE_ATTRIBUTE_ID_EAV_ATTRIBUTE_ATTRIBUTE_ID) constraint fails on source database. Orphan records id: 121,164 from
attribute_id has no referenced records in
In this case, we will just have to delete any orphaned records from the specified tables:
DELETE FROM catalog_eav_attribute WHERE attribute_id IN (121, 164);
The success message is displayed on completion of data migration.
You are nearly there now with completing the Migration of Magento1 Ecommerce website to Magento 2 platform. But it can’t be concluded without proper testing and we will have another blog update for you soon on this.
Here is a blog that we came across which lists out the things that we need to check and test once migration from Magento1 to Magento2 is completed.
N23 Web Agency specializes in Magento development and as strong futuristic Ecommerce developers, we have certified team of Magento developers that can successfully carry out migration of Magento 1 website to Magento 2 platform. We have a diligent testing process that ensures that your data, orders, customers and settings run perfectly on the new Magento 2 platform. To top it further our, Magento support services ensures our customers have a trusted and reliable Magento team that they can get hold of when they need.