Migrating from Magento 1 to Magento 2 @ Magento Meetup Wien

64
Migrating from Magento 1 to Magento 2 Matthias Zeis 21.09.2016

Transcript of Migrating from Magento 1 to Magento 2 @ Magento Meetup Wien

Migratingfrom Magento 1to Magento 2Matthias Zeis

21.09.2016

Vienna, Austriamzeismzeismzeismatthias-zeis.com

Who of youworks with Magento 2?

Who of youis migrating stores

to Magento 2?

SCENARIO

Merchant wants to migrate from M1 to M2

© Rebecca Slegel

WHAT?WHEN?HOW?

DATACODE

THEME

Treat it like a platform switch

because it is

MIGRATING DATACore data

3rd party dataYour data

© Ron Cogswell

Does Products & categories

Orders & Invoices Shipments & credit memos Core Configuration

Customers

Wishlists & Ratings

Does Doesn‘t Products & categories

Orders & Invoices Shipments & credit memos Core Configuration

Customers

Catalog DB layout updates Web API credentials

Wishlists & Ratings

Admin users & privileges

Media files

Custom data

3rd party data

1Add repositorycomposer config repositories.data-migration-toolgit https://github.com/magento/data-migration-tool

2 Install toolcomposer require magento/data-migration-tool:<version>

3 Configurehttp://devdocs.magento.com/guides/v2.0/migration/migration-tool-configure.html

1 Migrate settingsphp bin/magento migrate:settings /path/to/config.xml

2 Migrate dataphp bin/magento migrate:data /path/to/config.xml

3 Migrate deltaphp bin/magento migrate:delta /path/to/config.xml

Add mappings for customtables and table columns

COPY IGNORE RENAME TRANSFORM

A FEW LEARNINGS

(a.k.a. what bit me)

Massive toolTeam is working on it

Massive toolTeam is working on it

Schedule time

Clean up your data

Automate the process

Make tool run through first,

then configure properly

Organise config files

Configureextension data migration

manually

Test delta migration thoroughly

Alternatives ubertheme/module-ubdatamigration

Alternative to official data migration tool firegento/FireGento_FastSimpleImport2

Wrapper for Magento 2 ImportExport functionality firegento/FireGento_ExtendedImport2

Extended features for Import (ported from AvS_FastSimpleImport)

MIGRATING CODE

3rd party codeYour code

© Peter Gronemann

3rd partyfunctionalit

y

3rd partyfunctionalit

y

neededin new store?

3rd partyfunctionalit

y

DELETE

neededin new store?

missingin M2 core?

no

yes

3rd partyfunctionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

continue with

vendor?

no no

yes

yes

3rd partyfunctionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

continue with

vendor?

other 3rd partyor custom? no no

yes

yes

no

3rd partyfunctionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

continue with

vendor?

other 3rd partyor custom?

OTHER3RD PARTY

DO IT YOURSELF

no no

3rd party

custom

yes

yes

no

3rd partyfunctionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

continue with

vendor?

other 3rd partyor custom?

M2 extension available?

OTHER3RD PARTY

DO IT YOURSELF

no no

3rd party

custom

yes

yes

yes

no

3rd partyfunctionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

continue with

vendor?

other 3rd partyor custom?

M2 extension available?

OTHER3RD PARTY

DO IT YOURSELF

USE M2 EXTENSION

no no

3rd party

custom

yes

yes

yes

yes

no

no

your M1functionalit

y

your M1functionalit

y

neededin new store?

your M1functionalit

y

DELETE

neededin new store?

missingin M2 core?

no

yes

your M1functionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

3rd partyor custom?

no no

yes

yes

your M1functionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

3rd partyor custom?

3RD PARTY DO IT YOURSELF

no no 3rd party

custom

yes

yes

your M1functionalit

y

DELETE

neededin new store?

missingin M2 core?

USEM2 CORE

3rd partyor custom?

3RD PARTY DO IT YOURSELF

no no 3rd party

custom

yes

yes

REWRITE?

MIGRATE?

rewrite extension

automated testing

documentM1 behaviour

platform independent

code

coding standards

rewrite extension

automated testing

documentM1 behaviour

platform independent

code

coding standards

Awesome integer_net article series:

https://www.integer-net.com/magento-1-magento-2-shared-code-extensions/

migrate extension

clean M1 code

documentM1 behaviour

platform independent

code

refactor

Officialcode migration tool

magento/code-migration

Does Namespaces

Configuration XML files

Layout XML files

Magento code interaction

Module directory structure

Does Doesn‘t Namespaces

Configuration XML files

Layout XML files

Magento code interaction

Module directory structure

Template files & design

Changes in business logic

1 Get codegit clone https://github.com/magento/code-migration

2 Install toolcomposer install

<src> Code to be migrated (excluding core)

Prerequisites

<m1> M1 project code including vanilla core

<m2> M2 vanilla core

<dst> Empty directory for generated code

1 Migrate directory structurephp bin/migrate.php migrateModuleStructure <src> <dst>

2 Migrate layoutphp bin/migrate.php convertLayout <dst>

3 Migrate configurationphp bin/migrate.php convertConfig <dst>

4 Migrate PHP codephp bin/migrate.php convertPhpCode <dst> <m1> <m2>

Don‘t get confusedwith directories

USEOUT OF THE

BOXMAPPING

Is your Magento 1 version current?

noyes

GENERATEYOUR OWNMAPPING

1 php bin/utils.php generateClassDependency <m1>

2 php bin/utils.php generateClassMapping <m1> <m2>

3 php bin/utils.php generateModuleMapping <m1> <m2>

4 php bin/utils.php generateTableNamesMapping <m1>

5 php bin/utils.php generateViewMapping <m1> <m2>

6 php bin/migrate.php generateAliasMapping <m1> <m2>

7 php bin/migrate.php generateAliasMappingEE <m1> <m2>

Generating mappings yourself can be tricky

Double-checkwhat was (not) converted

1 Be pragmatic

2 Work together

3 Learn together

Sergii Shymko @ Imagine 2016: Code Migration Tool Presentation & Slides

Noelle Darlington @ Imagine 2016: Migration from M1 to M2 Presentation

Resources

Official data migration guidehttp://devdocs.magento.com/guides/v2.0/migration/bk-migration-guide.html

Data migration experience by Marcin Szterling (English, Youtube)Marcin Szterling - Data Migration from Magento 1 to Magento 2

Resources

Matthias Zeismzeismzeismzeismatthias-zeis.com

Thank you! Questions?

Slides will be online:http://www.slideshare.net/mzeis/

Matthias Zeismzeismzeismzeismatthias-zeis.com

Thank you! Questions?

Slides will be online:http://www.slideshare.net/mzeis/

LimeSoda is hiring!https://www.limesoda.com/jobs/