Advertisements

How To Migrate From Magento 1 To Magento 2 Only Customer and Orders

Today we take a quick look at Magento 1 to Magento 2 Migration.

First, you have to check Magento 2 Version as well as Magento 1 version. For checking Magento 2 version  use this command php bin/magento –version or you can log in to the admin panel and find Magento 2 version at the footer

For Magento 1 go to app/Mage.php and there you can find version like this

how to check Magento 1 version
how to check magento 1 version

Second, Add Data Migration Tool from here using composer.

And if you were unable to install it using composer then visit here and download the released zip file base on Magento 2 version and then unzip it into /vendor/magento/data-migration-tool 

and then run composer require magento/data-migration-tool: 

For me its composer require magento/data-migration-tool:2.3.5

Note: Use Data migration tool 2.3.5 for Magento 2.3.6

Third, Configure the Migration file.

For that, you need to rename /vendor/magento/data-migration-tool/etc/opensource-to-opensource/m1-verion/config.xml.dist  to config.xml

Use cp command for me its look like this cp vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.0.0/config.xml.dist vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.0.0/config.xml

Then Edit config.xml and copy-paste the below script and follow this script and its comment

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="urn:magento:module:Magento_DataMigrationTool:etc/config.xsd">
    <steps mode="settings">
        <step title="Settings Step">
            <integrity>Migration\Step\Settings\Integrity</integrity>
            <data>Migration\Step\Settings\Data</data>
        </step>
        <step title="Stores Step">
            <integrity>Migration\Step\Stores\Integrity</integrity>
            <data>Migration\Step\Stores\Data</data>
            <volume>Migration\Step\Stores\Volume</volume>
        </step>
    </steps>
    <!-- For Customer and Order only -->
    <steps mode="data">
        <!-- <step title="Data Integrity Step">
            <integrity>Migration\Step\DataIntegrity\Integrity</integrity>
        </step>
        <step title="EAV Step">
            <integrity>Migration\Step\Eav\Integrity</integrity>
            <data>Migration\Step\Eav\Data</data>
            <volume>Migration\Step\Eav\Volume</volume>
        </step> -->
        <step title="Customer Attributes Step">
            <integrity>Migration\Step\Customer\Integrity</integrity>
            <data>Migration\Step\Customer\Data</data>
            <volume>Migration\Step\Customer\Volume</volume>
        </step>
        <step title="Map Step">
            <integrity>Migration\Step\Map\Integrity</integrity>
            <data>Migration\Step\Map\Data</data>
            <volume>Migration\Step\Map\Volume</volume>
        </step>
        <!-- <step title="Url Rewrite Step">
            <integrity>Migration\Step\UrlRewrite\Version191to2000</integrity>
            <data>Migration\Step\UrlRewrite\Version191to2000</data>
            <volume>Migration\Step\UrlRewrite\Version191to2000</volume>
        </step> -->
        <!-- <step title="Log Step">
            <integrity>Migration\Step\Log\Integrity</integrity>
            <data>Migration\Step\Log\Data</data>
            <volume>Migration\Step\Log\Volume</volume>
        </step> -->
        <!-- <step title="Ratings Step">
            <integrity>Migration\Step\Ratings\Integrity</integrity>
            <data>Migration\Step\Ratings\Data</data>
            <volume>Migration\Step\Ratings\Volume</volume>
        </step> -->
        <!-- <step title="ConfigurablePrices step">
            <integrity>Migration\Step\ConfigurablePrices\Integrity</integrity>
            <data>Migration\Step\ConfigurablePrices\Data</data>
            <volume>Migration\Step\ConfigurablePrices\Volume</volume>
        </step> -->
        <step title="OrderGrids Step">
            <integrity>Migration\Step\OrderGrids\Integrity</integrity>
            <data>Migration\Step\OrderGrids\Data</data>
            <volume>Migration\Step\OrderGrids\Volume</volume>
        </step>
        <!-- <step title="Tier Price Step">
            <integrity>Migration\Step\TierPrice\Integrity</integrity>
            <data>Migration\Step\TierPrice\Data</data>
            <volume>Migration\Step\TierPrice\Volume</volume>
        </step> -->
        <step title="SalesIncrement Step">
            <integrity>Migration\Step\SalesIncrement\Integrity</integrity>
            <data>Migration\Step\SalesIncrement\Data</data>
            <volume>Migration\Step\SalesIncrement\Volume</volume>
        </step>
        <!-- <step title="Inventory Step">
            <integrity>Migration\Step\Inventory\Integrity</integrity>
            <data>Migration\Step\Inventory\Data</data>
            <volume>Migration\Step\Inventory\Volume</volume>
        </step> -->
        <!-- <step title="PostProcessing Step">
            <data>Migration\Step\PostProcessing\Data</data>
        </step> -->
    </steps>
    <steps mode="delta">
        <step title="Customer Attributes Step">
            <delta>Migration\Step\Customer\Delta</delta>
            <volume>Migration\Step\Customer\Volume</volume>
        </step>
        <step title="Map Step">
            <delta>Migration\Step\Map\Delta</delta>
            <volume>Migration\Step\Map\Volume</volume>
        </step>
        <!-- <step title="Log Step">
            <delta>Migration\Step\Log\Delta</delta>
            <volume>Migration\Step\Log\Volume</volume>
        </step> -->
        <!-- <step title="ConfigurablePrices step">
            <delta>Migration\Step\ConfigurablePrices\Delta</delta>
            <volume>Migration\Step\ConfigurablePrices\Volume</volume>
        </step> -->
        <!-- <step title="Tier Price Step">
            <delta>Migration\Step\TierPrice\Delta</delta>
            <volume>Migration\Step\TierPrice\Volume</volume>
        </step> -->
        <!-- <step title="Url Rewrite Step">
            <delta>Migration\Step\UrlRewrite\Version191to2000Delta</delta>
            <volume>Migration\Step\UrlRewrite\Version191to2000</volume>
        </step> -->
        <step title="OrderGrids Step">
            <delta>Migration\Step\OrderGrids\Delta</delta>
            <volume>Migration\Step\OrderGrids\Volume</volume>
        </step>
        <step title="SalesIncrement Step">
            <delta>Migration\Step\SalesIncrement\Delta</delta>
            <volume>Migration\Step\SalesIncrement\Volume</volume>
        </step>
        <!-- <step title="Inventory Step">
            <delta>Migration\Step\Inventory\Delta</delta>
            <volume>Migration\Step\Inventory\Volume</volume>
        </step> -->
    </steps>
    <!-- Here we have to connect database of magento 1 and magento 2 -->
    <!-- Please use duplicate Magento 1 database ( Not live one ) -->
    <source>
    <!-- Change -->
        <database host="localhost" name="<m1_datebase_name>" user="<m1_db_username>" password="<password>" />
    </source>
    <destination>
    <!-- Change -->
        <database host="localhost" name="<m2_datebase_name>" user="<m2_db_username>" password="<password>" />
    </destination>
    <!-- Leave this as it is unless you face error -->
    <options>
        <map_file>etc/opensource-to-opensource/1.9.0.0/map.xml.dist</map_file>
        <eav_map_file>etc/opensource-to-opensource/map-eav.xml.dist</eav_map_file>
        <eav_document_groups_file>etc/opensource-to-opensource/eav-document-groups.xml.dist</eav_document_groups_file>
        <eav_attribute_groups_file>etc/opensource-to-opensource/eav-attribute-groups.xml.dist</eav_attribute_groups_file>
        <log_map_file>etc/opensource-to-opensource/map-log.xml.dist</log_map_file>
        <log_document_groups_file>etc/opensource-to-opensource/log-document-groups.xml.dist</log_document_groups_file>
        <settings_map_file>etc/opensource-to-opensource/settings.xml.dist</settings_map_file>
        <customer_map_file>etc/opensource-to-opensource/map-customer.xml.dist</customer_map_file>
        <customer_document_groups_file>etc/opensource-to-opensource/customer-document-groups.xml.dist</customer_document_groups_file>
        <customer_attribute_groups_file>etc/opensource-to-opensource/customer-attribute-groups.xml.dist</customer_attribute_groups_file>
        <delta_document_groups_file>etc/opensource-to-opensource/deltalog.xml.dist</delta_document_groups_file>
        <order_grids_document_groups_file>etc/opensource-to-opensource/order-grids-document-groups.xml.dist</order_grids_document_groups_file>
        <map_document_groups>etc/opensource-to-opensource/map-document-groups.xml.dist</map_document_groups>
        <class_map>etc/opensource-to-opensource/class-map.xml.dist</class_map>
        <tier_price_map_file>etc/opensource-to-opensource/map-tier-price.xml.dist</tier_price_map_file>
        <stores_map_file>etc/opensource-to-opensource/map-stores.xml.dist</stores_map_file>
        <!--
        In case bulk_size=0 it will be auto-detected for every document.
        -->
        <bulk_size>0</bulk_size>
        <!--
        Set direct_document_copy = 1 for better performance.
        NOTE: 'source' and 'destination' databases MUST be placed on the same MySQL instance
        and 'destination' user MUST be granted with 'SELECT' permissions on 'source' database
         -->
        <direct_document_copy>0</direct_document_copy>
        <source_prefix />
        <dest_prefix />
        <auto_resolve_urlrewrite_duplicates>0</auto_resolve_urlrewrite_duplicates>
        <log_file>migration.log</log_file>
        <progress_bar_format>%percent%% [%bar%] Remaining Time: %remaining%</progress_bar_format>
        <upgrade_customer_password_hash>1</upgrade_customer_password_hash>
        <edition_migrate>opensource-to-opensource</edition_migrate>
        <edition_number>1.9.0.0</edition_number>
        <init_statements_source>SET NAMES utf8;</init_statements_source>
        <init_statements_destination>SET NAMES utf8;</init_statements_destination>
        <!-- Change -->
        <!-- Find encrpted_key from Magento 1 <m1_root_dir>/app/etc/local.xml and here you have to find crypt and copy String under key tag -->
        <!-- For example
            <crypt>
                <key><![CDATA[encrpted_key]]></key>
            </crypt>
            You need to copy encrpted_key
          -->
        <!-- <crypt_key /> -->
        <crypt_key>encrpted_key</crypt_key>
    </options>
</config>

Then you have to run the following command

php bin/magento migrate:settings –reset vendor/magento/data-migration-tool/etc///config.xml

php bin/magento migrate:data –auto vendor/magento/data-migration-tool/etc///config.xml

In future you might require this

php bin/magento migrate:delta –auto vendor/magento/data-migration-tool/etc///config.xml

for Me command look like this

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

php bin/magento migrate:data –auto vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.0.0/config.xml

php bin/magento migrate:delta –auto vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.0.0/config.xml

Thanks, Happy Coding

Source for this post How To Migrate From Magento 1 To Magento 2 Only Customer and Orders

You all are the semicolon to my statements; Please support me; Thanks