SlideShare uma empresa Scribd logo
1 de 44
Join us in Ibiza September 24th – 27th 2012
Prepare yourself for a new way of module development
Magento 2.0:
Ivan Chepurnyi
About Me
• Devoted to Magento Platform, since May 2007
• Former Magento Core Team member
• More than 5 Years of Magento Development
Experience
• Technical Director at EcomDev
• Magento Coach for European developers
Magento 1.x Issues
Module
Functionality
Non-transparent Module Structure
Layout
PHP Classes
Static Data
Translations
Emails
Definition
Configuration
Templates
app/design
app/locale
app/etc/modules
skin
app/code
Excessive Configurations
• Info for building
classes names of
• Models
• Blocks
• Helpers
• Info about file
path
• Layout
• Translate
Performance
• Timings for app
initialization
• Excessive memory
usage for building of
page layout
• Loading of redundant
XML configurations for
each request
Magento 2.0 Module Changes
Module Structure in Magento 2.0
app/code/<codePool>/<Namespace>/<Module>
Model
Helper
Block
controllers
etc
sql
data
view
locale
Classes that are used in MVC
application
Configuration files
Setup Scripts
Layouts, Templates, Static Data
Translations
Refactored Configuration
Changes in Main Configuration
• Definition of the module in
app/etc/modules/<Module_Name>.xml moved to
its etc/config.xml file
• Added option to specify dependency type
• Removed class aliases
• Fieldsets copy rules moved to a separate file
• Simplified rewrite system
New Modules Bootstrap Logic
1. Merging only <modules /> nodes from the
following file paths:
1. app/code/pool/Mage/<Module>/etc/config.xml
2. app/code/pool/<Namespace>/<Module>/etc/config.xml
3. app/etc/modules/<Namespace_ModuleName>.xml
New Modules Bootstrap Logic
2. Sorting of modules by dependency and checking
module activity
3. Merging of the config.xml file from sorted and
active modules
Dependency Types
• Hard Dependency (By Default)
• Soft Dependency
Snippet:
<Namespace_Module>
<depends>
<Mage_Category type=“soft”/>
<Mage_Core /> <!– This one is hard dependency 
</depends>
</Namespace_Module>
No More Class Aliases
• A full class name specified in all factory calls
• Mage::getModel(‘Namespace_Module_Model_Name’);
• Mage::helper(‘Namespace_Module_Helper_Name’);
• etc…
• Now all the factories use the same service locator
Rewrite Is Simplified
Rewrite is specified for class name instead of
<models />, <helpers /> and <blocks /> nodes:
<global>
<rewrites>
<ClassName_To_Rewrite>Class_That_Sustitutes</ClassName_To_Rewrite>
</rewrites>
</global>
Configuration Changes In Admin Panel
1. New ACL and authorization system
• Acl resources now placed at <Module>/etc/adminhtml/acl.xml
• It is even possible to connect own authentication model
2. Introduced Menu Builder
• A separate xml file at <Module>/etc/adminhtml/menu.xml
• Menu is build by XML instructions: <add />, <update /> and
<remove />
3. Added schema for these XML files validation
View Layer Changes
View Structure in Module
• Layout, templates, module CSS and JS files moved
from <area>/base/default theme and skin to the
module directory
• There is no more template and layout directories
on view level
• Module has a view configuration file for defining
own variables
View Directory
view
<area>
layout.xml
template.phtml
css/file.css
file.js
image.jpg
Magento Application Area
(frontend, adminhtml, install)
Layout File that is defined in
module config.xml
Template that is specified via
layout or block construct
Static files that can be
included into HTML markup
via layout or template
View Configuration
• File is merged from all modules and current
theme:
• <Module>/etc/view.xml
• <theme>/view.xml
• It has XML scheme for the validation of its content
• Can be used in feature for Design Editor
View Configuration Example
In module config or theme:
<?xml version=“1.0”?>
<view>
<vars module=”Namespace_Module”>
<var name=“items_count”>10</var>
</vars>
</view>
In template or block:
$this->getVar(‘items_count’, ‘Namespace_Module’);
Changes in Layout
• Changes in layout building behavior
• Hierarchical Layout Handles
• Containers instead of structural blocks
• New <move /> layout element
Layout building behavior
1. Adding layout handles updates
2. Extracting current handles and processing
<update handle=“<name>”/> node
3. Transforming XML structure into array tree and
sorting blocks within that tree without creating
the block
4. Applying scheduled remove and move operations
5. Building blocks and containers from array tree
Hierarchical Page Handles
• Realized via attributes for layout handle:
• type=“page”
• parent=“handle_name”
• Helps getting rid of layout duplicates
• Used to specify which layout handles are pages in
Design Editor functionality
Example of Page Handle
<catalog_category_view
translate="label”
type="page”
parent="default”>
<!– some structure -->
<catalog_category_view>
<catalog_category_view_type_layered
translate="label”
type="page"
parent="catalog_category_view”>
<!– some structure -->
<catalog_category_view_type_layered>
No more structural blocks
• Blocks will be refactored to be a final unit of view
• Containers will replace structural blocks
• Containers are not objects, they are rendered and
managed by layout model
Container Element
<container
name=“unique_name”
as=“alias_in_parent”
before=“sibling_name”
after=“sibling_name”
htmlTag=“div”
htmlClass=“css-class”
htmlId=“id-in-html”
label=“Container Name in Design Editor”>
<container />
<block />
</container>
Same as for block
Container HTML properties
(optional)
Container Name for Design Editor
functionality
≈
≈
Move Statement
<move
element=“name”
destination=“destination.element”
as=“new_alias”
after=”sibling_name”
before="sibling_name” />
The element that should be moved
Destination element in layout
Same as for block
≈
Themes
Simplified Themes
• Themes become more simple and flexible
• Only one configuration field in the admin panel
• It is possible to create as many inherited themes as you
need
• Skin become a style/locale variation on theme level
• Strict files relation in theme to the module
Theme Definition
• Every theme is defined by theme.xml in its
directory
• app/design/<area>/<package>/<theme>/theme.xml
• It contains:
• Requirements for Magento version
• Fallback information
• Name of the theme for admin user
Theme Definition
<design>
<package code=”package_code”>
<title>Default</title>
<theme version="2.0.0.0"
code=”theme_code” parent=“theme_code”>
<title>Default</title>
<requirements>
<magento_version
from=”1.0.0.0”
to=“1.0.0.0|*"/>
</requirements>
</theme>
</package>
</design>
Theme Definition
• package/title – package name, that is visible to
admin user
• theme/title – theme name, that is visible to admin
user
• package/@code – unique identifier of a package
• theme/@code – unique identifier of a theme
within the package
Theme Definition
• theme/@version – internal version of theme
• theme/@parent – theme name that the current
one is inherited
• magento_version/@from – minimal required
Magento version for theme
• magento_version/@to - maximum compatible
version of Magento for theme (can be a wildcard)
Theme Fallbacks
Fallback structure for dynamic files looks quite
simple, but you should consider theme inheritance:
1. <theme>/<Namespace_Module>/layout.xml
2. <parent_theme>/<Namespace_Module>/layout.x
ml
3. <Module>/view/layout.xml
Skin Fallbacks
• Static files (JS, CSS, Images) should be placed in theme skin directory
• Theme can have multiple skins, the default skin is “default”
• Skin directory allows fallbacks on locale level
• <theme>/skin/<skin_code>/<locale_code>/file.js
• <theme>/skin/<skin_code>/file.js
• <theme>/skin/<skin_code>/<locale_code>/<Namespace_Module>/file.js
• <theme>/skin/<skin_code>/<Namespace_Module>/file.js
Localization Inheritance
Localization Inheritance
It is possible to define inheritance between locales in
any xml file that is merged for global configuration:
<global>
<locale>
<inheritance>
<!-- Inheritance of UK Locale from US one -->
<en_GB>en_US</en_GB>
</inheritance>
</locale>
</global>
Developer Stuff
Developer Stuff
• dev/shell – same as Magento 1 shell directory
• dev/tests – set of different test suites:
• integration – tests that require Magento initialization
• js – Java Script UnitTests
• unit – test that can be run without Magento
• performance – load tests
• static – code analysis tools
Developer Stuff
• dev/tools – tools for developer
• migration – a set of tools for migration of Magento 1.x
module to 2.0
• classmap – generator of the class map
• batch_tests – batch test runner
Thank You
Your Questions
E-mail: ivan@ecomdev.org

Mais conteúdo relacionado

Mais procurados

24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...
24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...
24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...
Hossam El-Faxe
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
7) packaging and deployment
7) packaging and deployment7) packaging and deployment
7) packaging and deployment
techbed
 
What is struts_en
What is struts_enWhat is struts_en
What is struts_en
techbed
 
Drupal overview
Drupal overviewDrupal overview
Drupal overview
chintan4u
 

Mais procurados (19)

Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...
24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...
24221030 Enhance Oracle Sshr With Advanced Personalizations And Oa Fwk Extens...
 
Develop Engaging and High Performance Portal Themes That Power Exceptional Di...
Develop Engaging and High Performance Portal Themes That Power Exceptional Di...Develop Engaging and High Performance Portal Themes That Power Exceptional Di...
Develop Engaging and High Performance Portal Themes That Power Exceptional Di...
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
Maven II
Maven IIMaven II
Maven II
 
Building and managing java projects with maven part-III
Building and managing java projects with maven part-IIIBuilding and managing java projects with maven part-III
Building and managing java projects with maven part-III
 
Config management
Config managementConfig management
Config management
 
Fapi
FapiFapi
Fapi
 
7) packaging and deployment
7) packaging and deployment7) packaging and deployment
7) packaging and deployment
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
 
What is struts_en
What is struts_enWhat is struts_en
What is struts_en
 
integrasi template admin lte terbaru dengan laravel 7
integrasi template admin lte terbaru dengan laravel 7integrasi template admin lte terbaru dengan laravel 7
integrasi template admin lte terbaru dengan laravel 7
 
Tips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentTips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale Development
 
Search engine optimization (seo)
Search engine optimization (seo)Search engine optimization (seo)
Search engine optimization (seo)
 
Drupal overview
Drupal overviewDrupal overview
Drupal overview
 
EJB 3.0 and J2EE
EJB 3.0 and J2EEEJB 3.0 and J2EE
EJB 3.0 and J2EE
 
Templates81 special document
Templates81 special documentTemplates81 special document
Templates81 special document
 
Templates81 special document
Templates81 special documentTemplates81 special document
Templates81 special document
 

Destaque

chap 6 - Example şift
chap 6 - Example şiftchap 6 - Example şift
chap 6 - Example şift
ermis26
 
28.09.2015 how a foreign owned company can contribute to the well being of mo...
28.09.2015 how a foreign owned company can contribute to the well being of mo...28.09.2015 how a foreign owned company can contribute to the well being of mo...
28.09.2015 how a foreign owned company can contribute to the well being of mo...
The Business Council of Mongolia
 

Destaque (20)

Plaquette P-Val english version
Plaquette P-Val english versionPlaquette P-Val english version
Plaquette P-Val english version
 
141023 bd nv plaquette monde RH nl
141023 bd nv plaquette monde RH nl141023 bd nv plaquette monde RH nl
141023 bd nv plaquette monde RH nl
 
chap 6 - Example şift
chap 6 - Example şiftchap 6 - Example şift
chap 6 - Example şift
 
141008 bd nv plaquette DSI nl
141008 bd nv plaquette DSI nl141008 bd nv plaquette DSI nl
141008 bd nv plaquette DSI nl
 
Magento Growth Hacking
Magento Growth HackingMagento Growth Hacking
Magento Growth Hacking
 
141023 bd p val b2 b vente et modele commercial nl
141023 bd p val b2 b vente et modele commercial nl141023 bd p val b2 b vente et modele commercial nl
141023 bd p val b2 b vente et modele commercial nl
 
141023 bd plaquette p val strategie et management nl
141023 bd plaquette p val strategie et management nl141023 bd plaquette p val strategie et management nl
141023 bd plaquette p val strategie et management nl
 
Aircel & insight
Aircel & insightAircel & insight
Aircel & insight
 
10.29-31.2012, PRESENTATION, Corporate Presentation, Nick Cousyn
10.29-31.2012, PRESENTATION, Corporate Presentation, Nick Cousyn10.29-31.2012, PRESENTATION, Corporate Presentation, Nick Cousyn
10.29-31.2012, PRESENTATION, Corporate Presentation, Nick Cousyn
 
11.16-17.2015, PRESENTATION, The importance of economic diversification and i...
11.16-17.2015, PRESENTATION, The importance of economic diversification and i...11.16-17.2015, PRESENTATION, The importance of economic diversification and i...
11.16-17.2015, PRESENTATION, The importance of economic diversification and i...
 
BCM 1st Annual Summit Proceeding 2016
BCM 1st Annual Summit Proceeding 2016BCM 1st Annual Summit Proceeding 2016
BCM 1st Annual Summit Proceeding 2016
 
28.09.2015 how a foreign owned company can contribute to the well being of mo...
28.09.2015 how a foreign owned company can contribute to the well being of mo...28.09.2015 how a foreign owned company can contribute to the well being of mo...
28.09.2015 how a foreign owned company can contribute to the well being of mo...
 
25.11.2010, NEWSWIRE, Issue 146
25.11.2010, NEWSWIRE, Issue 14625.11.2010, NEWSWIRE, Issue 146
25.11.2010, NEWSWIRE, Issue 146
 
BCM Updates, 29 Sep 2016
BCM Updates, 29 Sep 2016BCM Updates, 29 Sep 2016
BCM Updates, 29 Sep 2016
 
29.10.2010, NEWSWIRE, Issue 142
29.10.2010, NEWSWIRE, Issue 14229.10.2010, NEWSWIRE, Issue 142
29.10.2010, NEWSWIRE, Issue 142
 
23.07.2010, NEWSWIRE, Issue 127-128
23.07.2010, NEWSWIRE, Issue 127-12823.07.2010, NEWSWIRE, Issue 127-128
23.07.2010, NEWSWIRE, Issue 127-128
 
30.04.2010, NEWSWIRE, Issue 116
30.04.2010, NEWSWIRE, Issue 11630.04.2010, NEWSWIRE, Issue 116
30.04.2010, NEWSWIRE, Issue 116
 
29.01.2010, NEWSWIRE, Issue 103
29.01.2010, NEWSWIRE, Issue 10329.01.2010, NEWSWIRE, Issue 103
29.01.2010, NEWSWIRE, Issue 103
 
11.2009, REPORT, Oyu Tolgoi Monthly Update, OT
11.2009, REPORT, Oyu Tolgoi Monthly Update, OT11.2009, REPORT, Oyu Tolgoi Monthly Update, OT
11.2009, REPORT, Oyu Tolgoi Monthly Update, OT
 
EXBS Oct. 2016 Mongolia I-O Seminar_KOSTI - Korea ICP and Classify (MN)
EXBS Oct. 2016 Mongolia I-O Seminar_KOSTI - Korea ICP and Classify (MN)EXBS Oct. 2016 Mongolia I-O Seminar_KOSTI - Korea ICP and Classify (MN)
EXBS Oct. 2016 Mongolia I-O Seminar_KOSTI - Korea ICP and Classify (MN)
 

Semelhante a Magento mega menu extension

Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
Ivan Chepurnyi
 
Designing for magento
Designing for magentoDesigning for magento
Designing for magento
hainutemicute
 
Silverstripe 2.4-highlights-gpmd
Silverstripe 2.4-highlights-gpmdSilverstripe 2.4-highlights-gpmd
Silverstripe 2.4-highlights-gpmd
GPMD Ltd
 

Semelhante a Magento mega menu extension (20)

Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5
 
Magento 2 View Layer Evolution
Magento 2 View Layer EvolutionMagento 2 View Layer Evolution
Magento 2 View Layer Evolution
 
Magento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcMagento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kc
 
Designing for magento
Designing for magentoDesigning for magento
Designing for magento
 
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014
 
Creating a basic joomla
Creating a basic joomlaCreating a basic joomla
Creating a basic joomla
 
Joomla Beginner Template Presentation
Joomla Beginner Template PresentationJoomla Beginner Template Presentation
Joomla Beginner Template Presentation
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Silverstripe 2.4-highlights-gpmd
Silverstripe 2.4-highlights-gpmdSilverstripe 2.4-highlights-gpmd
Silverstripe 2.4-highlights-gpmd
 
Tech Talk Live on Share Extensibility
Tech Talk Live on Share ExtensibilityTech Talk Live on Share Extensibility
Tech Talk Live on Share Extensibility
 
CodeIgniter & MVC
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
 
full-site-editing-theme-presentation.pptx
full-site-editing-theme-presentation.pptxfull-site-editing-theme-presentation.pptx
full-site-editing-theme-presentation.pptx
 
D8 training
D8 trainingD8 training
D8 training
 
How To Create Theme in Magento 2 - Part 1
How To Create Theme in Magento 2 - Part 1How To Create Theme in Magento 2 - Part 1
How To Create Theme in Magento 2 - Part 1
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Magento mega menu extension

  • 1. Join us in Ibiza September 24th – 27th 2012
  • 2. Prepare yourself for a new way of module development Magento 2.0: Ivan Chepurnyi
  • 3. About Me • Devoted to Magento Platform, since May 2007 • Former Magento Core Team member • More than 5 Years of Magento Development Experience • Technical Director at EcomDev • Magento Coach for European developers
  • 5. Module Functionality Non-transparent Module Structure Layout PHP Classes Static Data Translations Emails Definition Configuration Templates app/design app/locale app/etc/modules skin app/code
  • 6. Excessive Configurations • Info for building classes names of • Models • Blocks • Helpers • Info about file path • Layout • Translate
  • 7. Performance • Timings for app initialization • Excessive memory usage for building of page layout • Loading of redundant XML configurations for each request
  • 9. Module Structure in Magento 2.0 app/code/<codePool>/<Namespace>/<Module> Model Helper Block controllers etc sql data view locale Classes that are used in MVC application Configuration files Setup Scripts Layouts, Templates, Static Data Translations
  • 11. Changes in Main Configuration • Definition of the module in app/etc/modules/<Module_Name>.xml moved to its etc/config.xml file • Added option to specify dependency type • Removed class aliases • Fieldsets copy rules moved to a separate file • Simplified rewrite system
  • 12. New Modules Bootstrap Logic 1. Merging only <modules /> nodes from the following file paths: 1. app/code/pool/Mage/<Module>/etc/config.xml 2. app/code/pool/<Namespace>/<Module>/etc/config.xml 3. app/etc/modules/<Namespace_ModuleName>.xml
  • 13. New Modules Bootstrap Logic 2. Sorting of modules by dependency and checking module activity 3. Merging of the config.xml file from sorted and active modules
  • 14. Dependency Types • Hard Dependency (By Default) • Soft Dependency Snippet: <Namespace_Module> <depends> <Mage_Category type=“soft”/> <Mage_Core /> <!– This one is hard dependency  </depends> </Namespace_Module>
  • 15. No More Class Aliases • A full class name specified in all factory calls • Mage::getModel(‘Namespace_Module_Model_Name’); • Mage::helper(‘Namespace_Module_Helper_Name’); • etc… • Now all the factories use the same service locator
  • 16. Rewrite Is Simplified Rewrite is specified for class name instead of <models />, <helpers /> and <blocks /> nodes: <global> <rewrites> <ClassName_To_Rewrite>Class_That_Sustitutes</ClassName_To_Rewrite> </rewrites> </global>
  • 17. Configuration Changes In Admin Panel 1. New ACL and authorization system • Acl resources now placed at <Module>/etc/adminhtml/acl.xml • It is even possible to connect own authentication model 2. Introduced Menu Builder • A separate xml file at <Module>/etc/adminhtml/menu.xml • Menu is build by XML instructions: <add />, <update /> and <remove /> 3. Added schema for these XML files validation
  • 19. View Structure in Module • Layout, templates, module CSS and JS files moved from <area>/base/default theme and skin to the module directory • There is no more template and layout directories on view level • Module has a view configuration file for defining own variables
  • 20. View Directory view <area> layout.xml template.phtml css/file.css file.js image.jpg Magento Application Area (frontend, adminhtml, install) Layout File that is defined in module config.xml Template that is specified via layout or block construct Static files that can be included into HTML markup via layout or template
  • 21. View Configuration • File is merged from all modules and current theme: • <Module>/etc/view.xml • <theme>/view.xml • It has XML scheme for the validation of its content • Can be used in feature for Design Editor
  • 22. View Configuration Example In module config or theme: <?xml version=“1.0”?> <view> <vars module=”Namespace_Module”> <var name=“items_count”>10</var> </vars> </view> In template or block: $this->getVar(‘items_count’, ‘Namespace_Module’);
  • 23. Changes in Layout • Changes in layout building behavior • Hierarchical Layout Handles • Containers instead of structural blocks • New <move /> layout element
  • 24. Layout building behavior 1. Adding layout handles updates 2. Extracting current handles and processing <update handle=“<name>”/> node 3. Transforming XML structure into array tree and sorting blocks within that tree without creating the block 4. Applying scheduled remove and move operations 5. Building blocks and containers from array tree
  • 25. Hierarchical Page Handles • Realized via attributes for layout handle: • type=“page” • parent=“handle_name” • Helps getting rid of layout duplicates • Used to specify which layout handles are pages in Design Editor functionality
  • 26. Example of Page Handle <catalog_category_view translate="label” type="page” parent="default”> <!– some structure --> <catalog_category_view> <catalog_category_view_type_layered translate="label” type="page" parent="catalog_category_view”> <!– some structure --> <catalog_category_view_type_layered>
  • 27. No more structural blocks • Blocks will be refactored to be a final unit of view • Containers will replace structural blocks • Containers are not objects, they are rendered and managed by layout model
  • 28. Container Element <container name=“unique_name” as=“alias_in_parent” before=“sibling_name” after=“sibling_name” htmlTag=“div” htmlClass=“css-class” htmlId=“id-in-html” label=“Container Name in Design Editor”> <container /> <block /> </container> Same as for block Container HTML properties (optional) Container Name for Design Editor functionality ≈ ≈
  • 31. Simplified Themes • Themes become more simple and flexible • Only one configuration field in the admin panel • It is possible to create as many inherited themes as you need • Skin become a style/locale variation on theme level • Strict files relation in theme to the module
  • 32. Theme Definition • Every theme is defined by theme.xml in its directory • app/design/<area>/<package>/<theme>/theme.xml • It contains: • Requirements for Magento version • Fallback information • Name of the theme for admin user
  • 33. Theme Definition <design> <package code=”package_code”> <title>Default</title> <theme version="2.0.0.0" code=”theme_code” parent=“theme_code”> <title>Default</title> <requirements> <magento_version from=”1.0.0.0” to=“1.0.0.0|*"/> </requirements> </theme> </package> </design>
  • 34. Theme Definition • package/title – package name, that is visible to admin user • theme/title – theme name, that is visible to admin user • package/@code – unique identifier of a package • theme/@code – unique identifier of a theme within the package
  • 35. Theme Definition • theme/@version – internal version of theme • theme/@parent – theme name that the current one is inherited • magento_version/@from – minimal required Magento version for theme • magento_version/@to - maximum compatible version of Magento for theme (can be a wildcard)
  • 36. Theme Fallbacks Fallback structure for dynamic files looks quite simple, but you should consider theme inheritance: 1. <theme>/<Namespace_Module>/layout.xml 2. <parent_theme>/<Namespace_Module>/layout.x ml 3. <Module>/view/layout.xml
  • 37. Skin Fallbacks • Static files (JS, CSS, Images) should be placed in theme skin directory • Theme can have multiple skins, the default skin is “default” • Skin directory allows fallbacks on locale level • <theme>/skin/<skin_code>/<locale_code>/file.js • <theme>/skin/<skin_code>/file.js • <theme>/skin/<skin_code>/<locale_code>/<Namespace_Module>/file.js • <theme>/skin/<skin_code>/<Namespace_Module>/file.js
  • 39. Localization Inheritance It is possible to define inheritance between locales in any xml file that is merged for global configuration: <global> <locale> <inheritance> <!-- Inheritance of UK Locale from US one --> <en_GB>en_US</en_GB> </inheritance> </locale> </global>
  • 41. Developer Stuff • dev/shell – same as Magento 1 shell directory • dev/tests – set of different test suites: • integration – tests that require Magento initialization • js – Java Script UnitTests • unit – test that can be run without Magento • performance – load tests • static – code analysis tools
  • 42. Developer Stuff • dev/tools – tools for developer • migration – a set of tools for migration of Magento 1.x module to 2.0 • classmap – generator of the class map • batch_tests – batch test runner