The day when you finally made a decision to transit your web store to Magento 2 has come! Congratulations! Although this upgrade can be a serious challenge for your development team, it is absolutely worth every minute and every dollar spent, as it will bring your web shop to a whole new level. The official Magento case study declares that the amount of time required to perform a migration is less than 10 hours (Settings migration time: ~10 mins; Data migration time: ~9 hrs). Oh well.. be ready to spend much more time in real life as it is definitely not a "one-click" operation. The essential differences in architecture and theming alone dictate their own rules, which may end up in almost re-building your Magento store. But let's focus on a major advantage of this situation - it offers a great opportunity to clean out bad configurations, data and content. Magento 2 has a lot of benefits, it's much easier platform to maintain and extend.
Magento 2.0 upgrade involves four components:
- Magento themes,
Migration of the core data (products, customers, orders, store configurations, promotions) is quite simple. But there are a lot of pitfalls in extensions, themes and customizations transition.
You can find a detailed migration guide in Magento Developer Documentation 2.0. We have taken a liberty to simplify it and add some practical tips based on experience of our team, so here we go!
We'll cover upgrading Magento with the Data Migration Tool. (How to Install the Data Migration Tool) How it works? This tool identifies the differences in database structure between versions of Magento. Most of them are declared in map files. Each step in the process uses map files to transform data for the use in Magento 2 store. For example, you need to move a table. If the table was renamed appropriately, the map file detects it and the Data Migration Tool will transfer it Magento 2 database. To learn more about mapping files, refer to Data Migration Tool Internal Specification.
How migration looks in general:
Image Source: http://devdocs.magento.com/guides/v2.0/migration/migration-overview-how.html
The main reason of any failures is messed data, so in order to avoid it you need to create detailed migration plan.
Magento 2 migration plan in steps:
Step 1. Create detailed migration plan.
Step 2. Estimate the current state of your site:
- Perform a code audit
- Review the current version of your site. If you're running a super old version of Magento (Magento EE 1.10 or earlier or CE 1.5), forget about migrating and better re-build a new store "from scratch" in Magento 2.
- Highlight your Magento store vulnerabilities
- Review installed extensions, determine which of them are necessary for your store and which are optional.
- Find Magento 2 versions of your extensions. If they were custom, you need to develop new ones.
- Determine what database from the extensions have to be transferred.
Step 3. Capacity
- Review current hosting environment.
- Magento 2 needs more powerful hardware, more advanced topology and has many other requirements. You need to plan strengthening of server sources.
Step 4. Complete migration budget. General Magento update to 2.0 costs from $5,000 to $15,000, but in some cases it rises higher than $50,000.
Step 5. Install and test Magento 2:
- Install composer. (How to install composer)
- Set up a Magento 2.0 system that meets our system requirements .
- Replicate or dump your Magento 1.x database and use the data for migration.
Step 6. Install the Data Migration Tool
Step 7. Upgrade the Data Migration Tool. The versions of the Data Migration Tool and Magento must match, meaning that if you're running Magento 2.0.2, you must use the Data Migration Tool 2.0.2.
Step 8. Configure migration. Before you migrate any data, you must create a
config.xml configuration file from the provided sample.
Step 9. Let's start the migration itself:
- Check the network access of Data Migration Tool to both (Magento 1.x and Magento 2) databases. Open ports in your firewall.
- Stop all activity in the Magento 1.x Admin Panel
NOTE: Activity cannot resume until your Magento 2 store goes live.
- Stop all Magento 1.x cron jobs.
Transfer settings with migration tool]10
`bin/magento migrate:settings <Magento2 Directory>/vendor/magento/data-migration-tool/etc/ce-to-ce/126.96.36.199/config.xml`
Manually copy your Magento 1.x media files to Magento 2.0. All media files (for example, images for products, categories, the WYSIWYG editor, etc.) should be copied manually from
<your Magento 1 install dir>/mediato
<your Magento 2 install dir>/pub/media. However, do NOT copy
.htaccessfiles located in the Magento 1 media folder. Magento 2 has its own
.htaccess, that should be preserved.
Bulk copy your data from Magento 1 database to Magento 2 database with the Data Migration Tool.
`bin/magento migrate:data <Magento2 Directory>/vendor/magento/data-migration-tool/etc/ce-to-ce/188.8.131.52/config.xml`
Migrate Magento 1 extension code to Magento 2
Reindex all Magento 2.0 indexers.
Test your Magento 2.0 site.
Step 10. Incremental updates
Migrate the delta data (new orders, reviews, customer profiles) and migrate them to the new one.
`bin/magento migrate:delta -r <Magento2 Directory>/vendor/magento/data-migration-tool/etc/ce-to-ce/184.108.40.206/config.xml`
Test your new store.
Press Control+C to stop incremental migration and start it again after issues are resolved
Step 11. Go live
- Put M1 system in maintenance mode (DOWNTIME STARTS).
- Stop incremental updates (Press Control+C in the migration tool command window).
- Start M2 cron jobs.
- In your M2 system, reindex the stock indexer. Follow the link to learn more details from Configuration Guide.
- Hit pages in your M2 system to cache pages in advance of customers using your storefront.
- Perform any final verification of your M2 site.
- Change DNS, load balancers, and so on to point to new production hardware (DOWNTIME ENDS)
- The store is ready to use.
To avoid compatibility issues after modules, themes and customizations transition let's pay attention on some useful Magento 2 upgrade hints.
Manually migrated data:
- Media files (product and category images, the WYSIWYG editor, so on)
<your Magento 1 install dir>/mediato
<your Magento 2 install dir>/pub/media
.htaccess files located in the Magento 1
media folder. Magento 2 has its own
.htaccess that should be preserved.
- Storefront design.
- Admin users. Re-create all administrative users and associate them with access privileges.
- ACLs. Re-create all credentials for web services APIs (that is, SOAP, XML-RPC, and REST).
Tips for Migrating 1.x Extensions to Magento 2
Factories are autogenerated. For quick object creating at runtime you can take the model class, add Factory in the end, put in your constructor and call create(). e.g.
\Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactorythen further down:
$error = $this->rateErrorFactory->create();
Observers In Magento 2 observers have no direct impact on the flow.
Mage:: Calls All replaced with using the DI entities. E.g.
Quick Mappings Quick migration tips
Copying actually isn't a bad idea For easy migration with the Data Migration Tool you need to have the same structures in Magento 1.x and in 2.x. The problem is that they differ a lot. So open 2 PHPStorm windows one with M1 and Other with M2. Search for similar functionality to what is going on in the extension in the core code and COPY it.
The use of the вЂ__construct' method. When you're adjusting an M1 module to M2, add the construct method. It is used to load any required classes, set variables, and more depending on what the class is doing.
Tips for Migrating 1.x Themes to Magento 2
- Rather than having typical layout, template and locale directories within
app/design/frontend/, M2 has increased the modularity of themes by including ALL theme files within the same directory.
- Theme-specific module overrides, styles, js, media, etc are among the additions to the new theme structure.
- M1 themes need to be restructured for M2 and the required files must be added.
Good luck in migration to Magento 2! In case you need any assistance, don't hesitate to contact us and our certified Magento developers will upgrade your web store.