Migrating from Magento 1 to Magento 2 in 5 Simple Steps

Category: Others/ Misc

Presentation Description

Here are the 5 steps for Magento Migration - -Setup Magento 2 Instance -Download the Data Migration Tool -Configuring the Data Migration Tool -Provide the Prerequisites -Migrate the Websites


Presentation Transcript

slide 1:

https://www.netsolutions.com/magento-development Migrating from Magento 1 to Magento 2 in 5 Simple Steps With over 5 24000 merchants using Magento worldwide it continues to be the top-rated eCommerce platform. We discussed the compelling features and advantages of its latest version – Magento 2 at length in a previous post Migrating from Magento 1 to Magento 2: Why It is Inevitable for Retailers. Now we will go a step further presenting a step-by-step guide on how to migrate data from Magento 1 to 2. Magento 2 was released in November 2015 and has a completely different architecture than Magento 1. Magento 2 supports full page cache by default. It’s much faster than Magento 1 and supports PHP 7. It has a user-friendly checkout improved indexers and brings with it database optimizations.

slide 2:

https://www.netsolutions.com/magento-development However data migration may seem to be a nightmare to many in Magento development. This guide will help you get there in 5 simple steps. But before we jump into it it’s important to understand that this migration will soon be compulsory for everyone. Why Migrate to Magento 2  Magento has stopped rolling out any new features in the Magento 1.x versions now except for the security updates.  Magento team is likely to stop the official support for the Magento 1.x versions and stop releasing new security updates.  All the customizations you will be doing on your Magento 1.x version will have to be repeated in the Magento 2.x version whenever you decide to migrate. Understanding the Magento 2 Migration Process There are four stages you need to go through in order to migrate your website from Magento 1 to Magento 2:  Data Migration  Extension Migration  Customizations Migration  Theme Migration In this technical note I am going to explain the procedure of data migration using the data migration tool. Magento has released a data migration tool that helps developers migrate data from a Magento 1.x version to a Magento 2.x version. It is a command line interface that provides tracking logging verification progress and testing functions. Steps to Migrate from Magento 1 to 2

slide 3:

https://www.netsolutions.com/magento-development Step1: Setup Magento 2 Instance Download Magento 2 from https://www.magentocommerce.com/download without the sample data. Extract the downloaded data and follow the setup wizard to install the platform. Now you have Mangento 2 setup with an empty database. The data will be migrated in the database of this Magento 2 instance. Step 2: Download the Data Migration Tool Open the command line in the root folder of Magento 2. Download the data migration tool in the newly setup Magento 2 by following the command: composer require magento/data-migration-tool:version The version of the data migration tool must match the version of the Magento 2 codebase. The version of Magento 2 can be found in the composer.json file present in the root of the Magento 2 directory. For example for Magento version 2.1.0 the command would be: composer require magento/data-migration-tool:2.1.0 You will be prompted for the public key and your private key for authentication.

slide 4:

https://www.netsolutions.com/magento-development To get these key values login to your account in www.magentocommerce.com. After you login click on “My Accounts”. Now click on the developers link in the left menu and then click on security keys. Here you can find your keys. After filling these details a new folder named data migration tool will be created in magento 2 dir/vendor/magento/. You can download the data migration tool from githib also: https://github.com/magento/data-migration-tool. Step 3: Configuring the Data Migration Tool After downloading the data migration tool you will need to set the configration for it. Under the data-migration-tool/etc folder you can see 3 folders: ce-to-ce ce-to-ee ee-to-ee. The folder ce-to-ce includes configuration files and scripts for migrating data from Magento 1 CE to Magento 2 CE. Folder ce-to-ee includes configuration files and scripts for migrating data from

slide 5:

https://www.netsolutions.com/magento-development Magento 1 CE to Magento 2 EE. Folder ee-to-ee includes configuration files and scripts for migrating data from Magento 1 EE to Magento 2 EE. Enter the directory for which you are performing the migration for example: ce-to-ce in the case of migrating data from community edition to community edition. Now enter the directory with the Magento 1 version name. For instance if you are doing migration for Magento version then the you should enter the folder Make a copy of the file map.xml.dist and rename it map.xml in this folder. Use of this file explained in the migration step. Make a copy of the file config.xml.dist and rename it config.xml in this folder. Open this file and do the following changes in it: source database host”magento1host” name”magento1databasename” user”magento1databaseusername” password”magento1password” / /source destination database host”magento2host” name”magento2databasename” user”magento2databaseusername” password”magento2password” / /destination options source_prefixmagento1tablesprefix/source_prefix dest_prefixmagento2tablesprefix/dest_prefix crypt_keyf3e25abe619dae2387df9fs594f01985/crypt_key /options

slide 6:

https://www.netsolutions.com/magento-development Required Values: Under source enter the Magento 1 database details and in the destination enter the Magento 2 database details. Crypt_key value can be found in local.xml file which is located in the Magento 1 instance directory at: app/etc/local.xml in key tag. Optional Values: If you don’t have a prefix set for the Magento 1 and Magento 2 tables then you can leave the “1” source prefix and “2” source prefix fields empty. Database mapping between your Magento 1 and Magento 2 databases is performed through mapping files which are located in: Magento2 dir/vendor/magento/data-migration- tool/etc/ce version These files are used for changing the table names field names ignoring tables and fields and transferring data of a field to the Magento 2 format. We need to remove the .dist extension of these files to make use of these mappings. After removing the .dist from file names we need to change these file names removing the .dist in the config.xml file under the options tab. Here you can see the location of the files that needs to be renamed. options map_fileetc/ce-to-ce/ eav_map_fileetc/ce-to-ce/map-eav.xml.dist/eav_map_file eav_document_groups_fileetc/ce-to-ce/eav-document- groups.xml.dist/eav_document_groups_file eav_attribute_groups_fileetc/ce-to-ce/eav-attribute- groups.xml.dist/eav_attribute_groups_file log_map_fileetc/ce-to-ce/map-log.xml.dist/log_map_file

slide 7:

https://www.netsolutions.com/magento-development log_document_groups_fileetc/ce-to-ce/log-document- groups.xml.dist/log_document_groups_file settings_map_fileetc/ce-to-ce/settings.xml.dist/settings_map_file customer_map_fileetc/ce-to-ce/map-customer.xml.dist/customer_map_file customer_document_groups_fileetc/ce-to-ce/customer-document- groups.xml.dist/customer_document_groups_file customer_attribute_groups_fileetc/ce-to-ce/customer-attribute- groups.xml.dist/customer_attribute_groups_file delta_document_groups_fileetc/ce-to-ce/deltalog.xml.dist/delta_document_groups_file order_grids_document_groups_fileetc/ce-to-ce/order-grids-document- groups.xml.dist/order_grids_document_groups_file map_document_groupsetc/ce-to-ce/map-document- groups.xml.dist/map_document_groups class_mapetc/ce-to-ce/class-map.xml.dist/class_map /options This should now look like this: options map_fileetc/ce-to-ce/ eav_map_fileetc/ce-to-ce/map-eav.xml/eav_map_file eav_document_groups_fileetc/ce-to-ce/eav-document- groups.xml/eav_document_groups_file eav_attribute_groups_fileetc/ce-to-ce/eav-attribute- groups.xml/eav_attribute_groups_file

slide 8:

https://www.netsolutions.com/magento-development log_map_fileetc/ce-to-ce/map-log.xml/log_map_file log_document_groups_fileetc/ce-to-ce/log-document- groups.xml/log_document_groups_file settings_map_fileetc/ce-to-ce/settings.xml/settings_map_file customer_map_fileetc/ce-to-ce/map-customer.xml/customer_map_file customer_document_groups_fileetc/ce-to-ce/customer-document- groups.xml/customer_document_groups_file customer_attribute_groups_fileetc/ce-to-ce/customer-attribute- groups.xml/customer_attribute_groups_file delta_document_groups_fileetc/ce-to-ce/deltalog.xml/delta_document_groups_file order_grids_document_groups_fileetc/ce-to-ce/order-grids-document- groups.xml/order_grids_document_groups_file map_document_groupsetc/ce-to-ce/map-document-groups.xml/map_document_groups class_mapetc/ce-to-ce/class-map.xml/class_map /options Step 4: Provide the Prerequisites Before you start your migration you must do all of the following:  You need to stop all the current activities in Magento 1.  Stop all the cron jobs running on Magento 1 version and put the site on maintenance mode. The purpose of this is to stop all the activities that make any changes in the database. We need to make sure that there is no activity in the database once the data migration process starts.  Open ports in your firewall so that the migration tool can communicate with databases and the databases of Magento 1 and Magento 2 can communicate with each other.

slide 9:

https://www.netsolutions.com/magento-development  Migrate your theme to the Magento 2 theme structure.  Migrate all your Magento 1 customizations and extensions to Magento 2. In the event of unexpected issues that might cause redundancy we advise you to make a backup of your Magento 1.x database. Step 5: Migrate the Websites Now we will migrate the websites stores and system configuration like tax settings payments shippings etc… For this we need to run the following command in the Magento 2 instance: bin/magento migrate:settings -r|–reset path to config.xml -r|–reset is an optional argument that starts the migration from the beginning. path to config.xml is the absolute path to config.xml file and is a required field The command should be: sudo bin/magento migrate:settings /var/www/magento2/vendor/magento/data-migration- tool/etc/ce-to-ce/ Once it is done you will see the migration complete status.

slide 10:

https://www.netsolutions.com/magento-development Next you will need to run the data migration command: bin/magento migrate:data -r|–reset path to config.xml The command should be: sudo bin/magento migrate:data /var/www/magento2/vendor/magento/data-migration- tool/etc/ce-to-ce/ This command checks the consistency of tables and fields between Magento 1 and Magento 2. If any problem is found then an error message will appear with a list of all tables and fields that are not mapped. For example: if you extension tables error and the custom field that I created in one of the tables. So I got the following error.

slide 11:

https://www.netsolutions.com/magento-development To fix this problem you need to install the Magento 2 version of the extensions in the Magento 2 instance so that the missing tables are in the Magento 2 instance database as well. You can also ignore the tables and fields by adding their entries in map.xml file

slide 12:

https://www.netsolutions.com/magento-development ignore fieldfieldname/field /ignore ignore documenttablename/document /ignore After making the entries the corresponding tables and fields will be ignored and will not be migrated to the Magento 2 database. Run the migration command again to verify that the issues are fixed. The data migration is completed once you get the migration complete message.

slide 13:


slide 14:

https://www.netsolutions.com/magento-development After migration is completed if there are any new changes in the database such as new orders are placed or new reviews are added then you can migrate that data by executing the following command: bin/magento migrate:delta -r|–reset path to config.xml The command should be: sudo bin/magento migrate:delta /var/www/magento2/vendor/magento/data-migration- tool/etc/ce-to-ce/ This command can be stopped by pressing ctrl + C or else it will keep on running. Now your database is successfully migrated to Magento 2. Flush your Magento 2 cache and re-index all Magento 2 re-indexers then thoroughly test your new Magento 2 site. After the migration you need to copy the media files from Magento 1 to Magento 2. Brace yourself for the following challenges during migration: Home page not appearing correctly: If your Magento 1 version has a custom layout set for the home page then in Magento 2 after migration the home page will not appear correctly. You either need to create a custom layout

slide 15:

https://www.netsolutions.com/magento-development in Magento 2 or you can go to the Magento 2 admin panel and change the layout in pages for your home page. Products not appearing in category: You need to re-index all the indexers. In Magento 2 you need to go through the command line as it can’t be done from admin panel like in Magento 1. CSS js files not loading: For this you need to flush your cache and then deploy the static content. If you are still facing a problem after removing the cache then manually remove all the sub folders from the cache folder. Summing up Migrating from Magento 1 to 2 will soon be a necessity for eCommerce players it promises a number of benefits. Amid the cutthroat competition in the retail industry business owners need to be on their toes and constantly striving to offer more enticing ways to deliver a compelling customer experience. Magento migration is a significant step in that direction. If you are looking for any further assistance on migrating from Magento 1 to 2 or create digital solutions for better customer or employee engagement we can help. Please contact us at infonetsolutions.com.

authorStream Live Help