SlideShare una empresa de Scribd logo
1 de 33
Sergii Shymko
Software Engineer
Magento
Running 1.x Extensions
on Magento 2
Legal
Copyright © 2014 Magento, Inc. All Rights Reserved.
Magento®, eBay Enterprise™ and their respective logos are trademarks, service marks,
registered trademarks, or registered service marks of eBay, Inc. or its subsidiaries. Other
trademarks or service marks contained in this presentation are the property of the
respective companies with which they are associated.
This presentation is for informational and discussion purposes only and should not be
construed as a commitment of Magento, Inc. or GSI Commerce, Inc. d/b/a eBay Enterprise
(“eBay Enterprise”) or of any of their subsidiaries or affiliates. While we attempt to ensure
the accuracy, completeness and adequacy of this presentation, neither Magento, Inc.,
eBay Enterprise nor any of their subsidiaries or affiliates are responsible for any errors or
will be liable for the use of, or reliance upon, this presentation or any of the information
contained in it. Unauthorized use, disclosure or dissemination of this information is
expressly prohibited.
Extension Selection
Too complex
“Hello World”
$0
Subject Extension
Vertical Navigation with CSS Classes
magentocommerce.com/magento-connect/vertical-navigation-with-css-classes.html
As of May 8, 2014
53,528
Rico Neitzel
Vinai Kopp
Raúl Fishman
OSL 3.0
Storefront
Admin Panel
Source Code Stats
PHP
25%
Config
25%
CSV
25%
Templates
9%
Layout
8%
CSS
8%
Let’s Make It Work with M2 !
Magento 1.x Magento 2
Directory Structure
app/
code/
community/
<Vendor>/<Module>/
etc/modules/
locale/<locale>/
design/
<area>/base/default/
skin/
<area>/base/default/
app/
code/
<Vendor>/<Module>
/
etc/
i18n/<locale>/
view/<area>/
Configuration Files1
Magento 1.x Magento 2
Config Reorganization
app/
code/community/
RicoNeitzel/VertNav/
etc/
config.xml
app/
code/
RicoNeitzel/VertNav/
etc/[<area>/]
module.xml
…
…
Magento2Magento1.x
Module Definition
<config>
<modules>
<RicoNeitzel_VertNav>
<version>0.4.2</version>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Catalog/>
<config>
<module name="RicoNeitzel_VertNav"
version="0.4.2"
active="true">
<depends>
<module name="Magento_Catalog"/>
<module_dir>/etc/module.xml
app/etc/modules/<module>.xml
<module_dir>/etc/config.xml
Magento2Magento1.x
System Configuration
<config>
<sections>
<catalog>
<groups>
<vertnav>
<fields>
<hide_vertnav>
<sort_order>10</sort_order>
<config>
<system>
<section id="catalog">
<group id="vertnav">
<field id="hide_vertnav"
type="select"
sortOrder="10">
<module_dir>/etc/system.xml
<module_dir>/etc/adminhtml/system.xml
View Layer2
Magento 1.x Magento 2
Static Files
skin/
frontend/
base/
default/
vertnav.css
app/
code/
RicoNeitzel/VertNav/
view/
frontend/
style.css
Magento 1.x Magento 2
Templates
app/
design/
frontend/
base/default/
template/
vertnav/
left.phtml
app/
code/
RicoNeitzel/VertNav/
view/
frontend/
left.phtml
Magento 1.x Magento 2
Layout Files
app/
design/
frontend/
base/default/
layout/
vertnav.xml
app/
code/
RicoNeitzel/VertNav/
view/
frontend/
layout/
default.xml
…
Magento2Magento1.x
Layout Format
<layout>
<default>
<reference name="left">
<block type="vertnav/navigation"
name="catalog.vertnav"
template="vertnav/left.phtml"/>
<layout>
<referenceContainer name="left">
<block class="RicoNeitzel_VertNav_Block_Navigation"
name="catalog.vertnav"
template="RicoNeitzel_VertNav::left.phtml"/>
vertnav.xml
default.xml
<?php // code ;)3
Magento2Magento1.x
Namespaces
class Mage_Catalog_Block_Navigation {...}
class RicoNeitzel_VertNav_Block_Navigation
extends Mage_Catalog_Block_Navigation {...}
namespace MagentoCatalogBlock;
class Navigation {...}
class RicoNeitzel_VertNav_Block_Navigation
extends MagentoCatalogBlockNavigation {...}
Prefixes, PHP < 5.3
Namespaces, PHP ≥ 5.3
Magento 1.x Magento 2
Core Reorganization
app/
code/core/
Mage/
Adminhtml/
Page/
Core/
Mage.php
lib/Varien/
app/
code/
Magento/
Backend/
Theme/
Core/
Store/
lib/Magento/Framework/
No “Mage” in Magento 2
Dependency Injection
Magento2Magento1.x
Dependency on Singleton
Mage::getSingleton('module/class');
Mage::getResourceSingleton('module/class');
Mage::helper('module');
function __construct(
VendorModuleClass $service
) {
$this->_service = $service;
}
Service Location
Constructor Injection
Magento2Magento1.x
Dependency on Transient
Mage::getModel('module/class');
Mage::getResourceModel('module/class');
function __construct(
VendorModuleClassFactory $factory
) {
$this->_factory = $factory;
}
$transientObj = $this->_factory->create();
Static Factory Methods
Factory Code Generation
Internationalization
Localization
Magento 1.x Magento 2
Dictionaries
app/
locale/
de_DE/
RicoNeitzel_VertNav.csv
es_MX/
RicoNeitzel_VertNav.csv
app/
code/
RicoNeitzel/VertNav/
i18n/
de_DE.csv
es_MX.csv
Magento2Magento1.x
Localization via “gettext”
class Vendor_Module_Helper_Data
extends Mage_Core_Helper_Abstract
{
// Literally empty
}
echo Mage::helper('module')->__('Wake up, %s...', 'Neo');
echo __('Wake up, %1...', 'Imagine attendee');
Module Context
Global Function
We’re All Set !4
Effort & Gains
20 hours
 Single module dir
 Config validation
 Unit testable
19 commits
Sergii Shymko
sshymko@ebay.com
sergey@shymko.net
github.com/magento/magento2 – Magento 2
github.com/riconeitzel/VertNav – original extension
github.com/sshymko/VertNav – extension M2 fork
Thank You!
Q & A

Más contenido relacionado

La actualidad más candente

La actualidad más candente (9)

Continuous Integration in android
Continuous Integration in androidContinuous Integration in android
Continuous Integration in android
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress
 
Integrate Shindig with Joomla
Integrate Shindig with JoomlaIntegrate Shindig with Joomla
Integrate Shindig with Joomla
 
Primefaces Confess 2012
Primefaces Confess 2012Primefaces Confess 2012
Primefaces Confess 2012
 
Substance checking-for-google-in-seo-by-sofia-azam
Substance checking-for-google-in-seo-by-sofia-azamSubstance checking-for-google-in-seo-by-sofia-azam
Substance checking-for-google-in-seo-by-sofia-azam
 
Substance checking-for-google-in-seo-by-sofia-azam
Substance checking-for-google-in-seo-by-sofia-azamSubstance checking-for-google-in-seo-by-sofia-azam
Substance checking-for-google-in-seo-by-sofia-azam
 
6 global library function provided by open cart
6 global library function provided by open cart6 global library function provided by open cart
6 global library function provided by open cart
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
Consuming & embedding external content in WordPress
Consuming & embedding external content in WordPressConsuming & embedding external content in WordPress
Consuming & embedding external content in WordPress
 

Similar a Running Magento 1.x Extension on Magento 2

Zepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_FinalZepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_Final
Max Pronko
 

Similar a Running Magento 1.x Extension on Magento 2 (20)

Zepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_FinalZepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_Final
 
Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2
 
Magento vs big commerce a detailed comparison guide - ziffity
Magento vs big commerce  a detailed comparison guide - ziffityMagento vs big commerce  a detailed comparison guide - ziffity
Magento vs big commerce a detailed comparison guide - ziffity
 
Magento E-Commerce Customized Package-5
Magento E-Commerce Customized Package-5Magento E-Commerce Customized Package-5
Magento E-Commerce Customized Package-5
 
Magento tutorial
Magento tutorialMagento tutorial
Magento tutorial
 
Magento Imagine 2014: Barcamp PHP 5.4 Performance Benchmarking
Magento Imagine 2014: Barcamp PHP 5.4 Performance Benchmarking Magento Imagine 2014: Barcamp PHP 5.4 Performance Benchmarking
Magento Imagine 2014: Barcamp PHP 5.4 Performance Benchmarking
 
The biggest stores on Magento
The biggest stores on MagentoThe biggest stores on Magento
The biggest stores on Magento
 
BEGINNERS’ GUIDE TO MAGENTO PLUGINS, EXTENSIONS, MODULES
BEGINNERS’ GUIDE TO MAGENTO PLUGINS, EXTENSIONS, MODULESBEGINNERS’ GUIDE TO MAGENTO PLUGINS, EXTENSIONS, MODULES
BEGINNERS’ GUIDE TO MAGENTO PLUGINS, EXTENSIONS, MODULES
 
Magento b2 b portals
Magento b2 b portalsMagento b2 b portals
Magento b2 b portals
 
Developer Preview Live – Release Readiness LIVE, Spring '18
Developer Preview Live – Release Readiness LIVE, Spring '18Developer Preview Live – Release Readiness LIVE, Spring '18
Developer Preview Live – Release Readiness LIVE, Spring '18
 
Magento development
Magento developmentMagento development
Magento development
 
Affiliate module-magento
Affiliate module-magentoAffiliate module-magento
Affiliate module-magento
 
Magento customization
Magento customizationMagento customization
Magento customization
 
New Features in Magento Enterprise Edition 1.14 (EE) Magento Community Editio...
New Features in Magento Enterprise Edition 1.14 (EE) Magento Community Editio...New Features in Magento Enterprise Edition 1.14 (EE) Magento Community Editio...
New Features in Magento Enterprise Edition 1.14 (EE) Magento Community Editio...
 
Magento commerce
Magento commerceMagento commerce
Magento commerce
 
Magento b2 b website
Magento b2 b websiteMagento b2 b website
Magento b2 b website
 
An e-Commerce Platform for Selling Single Product Reltus for Tinnitus
An e-Commerce Platform for Selling Single Product Reltus for Tinnitus	An e-Commerce Platform for Selling Single Product Reltus for Tinnitus
An e-Commerce Platform for Selling Single Product Reltus for Tinnitus
 
Magento b2 c portals
Magento b2 c portalsMagento b2 c portals
Magento b2 c portals
 
Magento developer uk
Magento developer ukMagento developer uk
Magento developer uk
 
Magento web design
Magento web designMagento web design
Magento web design
 

Más de Sergii Shymko

Más de Sergii Shymko (12)

Magento 2 Changes Overview
Magento 2 Changes OverviewMagento 2 Changes Overview
Magento 2 Changes Overview
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions Distribution
 
Developing Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with MagentoDeveloping Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with Magento
 
Black Magic of Code Generation in Magento 2
Black Magic of Code Generation in Magento 2Black Magic of Code Generation in Magento 2
Black Magic of Code Generation in Magento 2
 
Composer in Magento
Composer in MagentoComposer in Magento
Composer in Magento
 
Magento 2 Code Migration Tool
Magento 2 Code Migration ToolMagento 2 Code Migration Tool
Magento 2 Code Migration Tool
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions Distribution
 
Magento 2 Enhanced Theme/Skin Localization
Magento 2 Enhanced Theme/Skin LocalizationMagento 2 Enhanced Theme/Skin Localization
Magento 2 Enhanced Theme/Skin Localization
 
Developing Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with MagentoDeveloping Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with Magento
 
Magento 2 View Layer Evolution
Magento 2 View Layer EvolutionMagento 2 View Layer Evolution
Magento 2 View Layer Evolution
 
Magento 2 Theme Localization
Magento 2 Theme LocalizationMagento 2 Theme Localization
Magento 2 Theme Localization
 
Magento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration ToolsMagento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration Tools
 

Último

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 

Último (20)

Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 

Running Magento 1.x Extension on Magento 2

Notas del editor

  1. Uses various framework parts Not trivial
  2. Magento 1.x – module in 5 directories Magento 2 – module in 1 directory <module_dir>/ = <Vendor>/<Module>/
  3. Merging preserved XSD validation
  4. Convention over configuration
  5. PSR compliance
  6. No class “Mage” Confusion ;)
  7. Convention over configuration
  8. XSD validation of config