Migrate Magento 1 to Magento 2



Magento 2 is built on an altogether different architecture and is much more optimized, fast and user-friendly. Magento released an official Data Migration Tool that will help developers migrate site data from Magento 1 to Magento 2. 

I will suggest to do the migration first on a staging server and after it finally on Live Site server. Before migration better to take code and database backup, in order to be ready for any rescue of the site.


STEPS FOR MIGRATION

Install the Magento migration tool (steps given below) and make sure it has access to both the Magento 1 and Magento 2 databases to start the migration process. 

Intallation of tool is done in a new Magento2 installation with Composer. It’s not an extension, but standalone shell app that requires Magento2 framework to work. 

It’s located in vendor/magento/data-migration-tool/bin/migrate.
If you are migrating to Magento version 2.0.0, you need to have Migration tool version 2.0.0, likewise if you have Magento version 2.0.2, you need migration tool version 2.0.2. If there is a version mismatch, the migration won’t be successful, as different Magento versions can have different database structures and need different mapping mechanisms.

Go to your Magento root directory in your server, and run following command:
composer require magento/data-migration-tool:2.0.2

CONFIGURATION OF MIGRATION

Say you Magento 1 version is 1.9.2.4 and Magento 2 version is 2.0.2.
Edit configuration xml files on path vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.4/config.xml and update source databse name and destination database as below:

<source>
  <database host="localhost" name="magento1_db" user="root" password="dbpassword"/>
</source>
<destination>
  <database host="localhost" name="magento2_db" user="root" password="dbpassword"/>
</destination>

<options>
    <source_prefix>magento1</source_prefix>  (if any else leave the tag as <source_prefix/>)
    <crypt_key>Look into Magento 1 root directory/app/etc/local.xml</crypt_key>

</options>

MIGRATION MODES

There are 3 main commands/steps for the migration: settings, data and delta. 
Change map.xml.dist to map.xml and do for all others files also

1) Migrate Settings - Migrates settings, websites and stores to M2. Most of Magento data is related to websites and stores.


Run: php bin/magento migrate:settings vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.4/config.xml
After this step you may need to reindex and flush the cache through command.

2) Migrate Data - This step will transfer categories, products, customers, orders, ratings, wishlists, sales rules and all other data.
Run: php bin/magento migrate:data vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.4/config.xml
Now run data command after migration step. While this command , you may come up with errors to ignore the document or fields.

To ignore it we need to add following to map.xml file.

<source>
  <field_rules>
    <ignore>
      <field>sales_flat_order.custom_column</field>
    </ignore>

..

The problem usually arises when you use a Magento extension whose table structure is not compliant with the Magento 2 database structure. In that case, you can either 

install the Magento 2 version of the extension or you can ignore those files by adding <ignore> tags to the map.xml file.
Further Class error may arise. Delete the classes from the attribute fields or Map them through class.xml 
Once you solve the issue, you can re-run the migrate data command. 

3) Migrate Delta - After successful data migration, you can always just append new M1 entries to M2 database with delta migration, it will continue where it stopped 

last time. Delta doesn’t migrate new or changed products or categories (at the moment of writing), only customers, orders, and similar customer related data.
Run: php bin/magento migrate:delta vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.4/config.xml
Finally reindex and flush the cache.

MANUALLY MIGRATING MEDIA

Media Files - Put "media" directory of magento 1 in pub/media path of magento 2

POST-MIGRATION STEPS

- Install a new theme in Magento 2
- Installation of Magento 2 extensions 
- Custom development that were done in magento 1 needs to be done for magento 2


READ OTHER ARTICLES OF MAGENTO 2

Magento 1 vs Magento 2: Difference and Features

Upgrade Magento 2.1 to 2.2

Magento 2.1.x vs 2.2.x : Difference in including css,js,google fonts

Magento 2 Reindexing CE vs EE : Differences in Magento indexing of Magento Community Edition 2.x and Enterprise Edition 2.x?

No comments:

Post a Comment

Buy/Sell Source Code of Website,Apps,Softwares

Install sample data in magento 2