SlideShare a Scribd company logo
This is
Magento 2 Theming
KSS (Knowledge sharing session) by Suman KC
I am Suman KC
Magento developer
www.linkedin.com/in/sumankc
www.sumankc.com
Hello!
Topics
◉Introduction
◉Themes
◉Layout
◉Templates
◉CSS
Introduction
Magento & Magento 2 intro leading to theming
aspects
1
◉eCommerce platform
◉Huge
◉Unique
◉Poor documentation
◉Edition(Community & enterprise)
Magento in general
14K+ Files & 5K+ Folders
That’s a lot of files & directory
109MBand that's before you add themes, modules and all your image libraries
300+ tablesProduct & category alone has 50+ tables relations
Magento1.9.2
Magento views are separated into
Magento views
LayoutsBlocks Templates
Themes
Creation, Structure, Configuration & Inheritance
2
1. Prerequisites
◉ Not modify out of box Magento themes
[Compatibility,upgradability & easy maintenance]
◉ Set magento application to developer mode
[mode influences the way static files are cached]
Creating a theme
app/design/frontend/<Vendor>/
├── <theme>/
│ ├── etc/
│ │ ├── view.xml
│ ├── web/
│ │ ├── images
│ │ │ ├── logo.svg
│ ├── registration.php
│ ├── theme.xml
│ ├── composer.json
Theme directory structure
<theme_dir>/
├── <Vendor>_<Module>/
│ ├── web/
│ │ ├── css/
│ │ │ ├── source/
│ ├── layout/
│ │ ├── override/
│ ├── templates/
├── etc/
├── i18n/
├── media/
├── web/
│ ├── css/
│ │ ├── source/
│ ├── fonts/
│ ├── images/
│ ├── js/
├── composer.json
├── registration.php
├── theme.xml
TypicalMagentotheme
directory
Apply a theme
1. In Admin, go to Stores > Configuration > Design.
2. In the Store View drop-down field, select the store view where you
want to apply the theme.
3. On the Design Theme tab, select your newly created theme in the
Design Theme drop-down.
4. Click Save Config.
5. If caching is enabled, clear the cache.
6. To see your changes applied, reload the store front pages.
Configure a theme (admin section)
The properties of product images used on the storefront are stored in
the view.xml configuration file.
<theme_dir>/etc/view.xml
Image properties are configured for each image type defined by the id
and type attributes of the <image> element:
<images module="Magento_Catalog">
<image id="unique_image_id" type="image_type">...</image>
<images/>
Configure image properties
◉ Set a parent theme
◉ Override view.xml file
◉ Override static assets
Theme inheritance
◉ Override templates
◉ Extend Layouts
◉ Override Layouts
◉ Current theme static files: <theme_dir>/web/
◉ Ancestor’s static files, recursively, until a theme with no parent is
reached: <parent_theme_dir>/web/
Module context
◉ Current theme module static files
<theme_dir>/<Namespace>_<Module>/web/
◉ Ancestor themes module static files, recursively, until a theme with
no ancestor is reached:
<parent_theme_dir>/<Namespace>_<Module>/web/
Override static assets
Fallback schema
◉ Current theme templates:
<theme_dir>/<Namespace>_<Module>/templates
◉ Ancestors themes templates, recursively, until a theme with no
ancestor is reached:
<parent_theme_dir>/<Namespace>_<Module>/templates
◉ Module templates: <module_dir>/view/frontend/templates
Override templates
The system collects layout files in the following order
◉ Current theme layouts: <theme_dir>/<Vendor>_<Module>/layout/
◉ Ancestors themes <parent_theme_dir>/<Vendor>_<Module>/layout/
◉ Module templates: <module_dir>/view/frontend/templates
◉ Module layouts for the frontend area:
<module_dir>/view/frontend/layout/
◉ Module layouts for the base area: <module_dir>/view/base/layout/
Extend Layouts
To override the instructions from an ancestor theme layout file:
● Create a layout file with the same name in the
<theme_dir>/<Vendor>_<Module>/layout/override/theme/<Vendor>/
<ancestor_theme> directory.
*Though overriding layouts is not recommended, it is still possible, and might
be a solution for certain customization tasks.
Overriding Layouts
Layout
Instruction, extending, overriding and Customizations
3
◉NO local.xml file - to modify, make a new xml
file with same name
◉All attributes & definitions from origianl
module will be inherited
◉move action - great feature of new XML
◉Structural & content blocks to containers &
blocks
Layouts
◉ Common layout instructions to customize layout
Layout instructions
◉<block>
◉<container>
◉<before> & <after>
◉<action>
◉<referenceBlock>
and
<referenceContainer
>
◉<move>
◉<remove>
◉<update>
◉<argument>
◉ Container is a structure without content which holds other
blocks and containers
◉ You can specify HTML attributes...
◉ When extending, we have referenceBlock &
referenceContainer
Containers and blocks
◉ Updates in <referenceBlock> & <referenceContainer> are
applied to the corresponding <block> or <container>.
◉ Eg. if you make a reference by <referenceBlock name=”right”>,
you are targeting the block <block name=”right”>
◉ Attributes = remove & display, values = true/false
◉ <referenceBlock name="block.name" remove="true" />
<referenceBlock> & <referenceContainer>
◉ <move> helps moving elements to other location without the
need to unset or removing from one place
<move element="name.of.an.element" destination="name.of.destination.element"
as="new_alias" after="name.of.element.after"
before="name.of.element.before"/>
◉ <remove> to remove static resource linked in a page <head
and to remove blocks & containers
<head>
<!-- Remove local resources -->
<remove src="css/styles-m.css" />
<move> & <remove>
Extend a layout
Overriding layouts
Overriding layouts (from parent theme)
1. Set page layout
<page layout="2columns-left" xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
...
</page>
2. Include/remove static resources
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
<head>
<!-- Add local resources -->
<css src="css/my-styles.css"/>
<css src="css/ie-9.css" ie_condition="IE 9" />
<remove src="my-js.js"
Layout Customization examples
3. Create a container - Reference a container
<container name="some.container" as="someContainer" label="Some Container" htmlTag="div"
htmlClass="some-container" />
<referenceContainer name="header.panel">
<block class="MagentoFrameworkView…”>....</block>
4. Create a block - Reference block
<block class="MagentoCatalogBlockProductViewDescription" name="product.info.sku"
template="product/view/attribute.phtml" after="product.info.type">
<arguments>...</arguments>
</block>
<referenceBlock name="logo">...</referenceBlock>
Layout Customization examples
Templates
Basic concepts, customizations & overriding
4
◉ Template hint - to locate template(store> config > advanced > developer
> debug > enable template)
◉ Copy template to your theme following convention
◉ Make required changes
For eg. form inside
<Magento_Review_module_dir>/view/frontend/templates/form.phtml
app/design/frontend/OrangeCo/orange/Magento_Review/templates
Template customization walkthrough
◉ Templates are usually initiated in layout files.
◉ Each layout block has an associated template.
◉ The template is specified in the template attribute of the layout
instruction. For example, from
<Magento_Catalog_module_dir>/view/frontend/layout/catalog_category_view.xml
:
<block class="MagentoCatalogBlockCategoryView" name="category.image"
template="Magento_Catalog::category/image.phtml"/>
Template initiation
Templates are stored in the following locations:
● Module templates:
<module_dir>/view/frontend/templates/<path_to_templates>
● Theme templates:
<theme_dir>/<Namespace>_<Module>/templates/<path_to_templates>
Conventional template location
Customize email templates using theme
◉ Template fallback is supported for email templates
◉ For eg, to override the New Order email template, create a template
named order_new.html in the <theme_dir>/Magento_Sales/email
◉ Customize using Magento Admin
◉ In the Magento Admin, navigate to MARKETING > Communications > Email
Templates
◉ Click Add New Template.
Customizing email templates
CSS
Include, preprocessor & Magento UI Library
5
In the Magento application, CSS files are included in layout files.
◉ Include css in
<Magento_Blank_theme_dir>/Magento_Theme/layout/default_head_blocks.xml
◉ <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
<head>
<css src="css/styles-m.css" />
◉ Module-specific styles - /<Namespace>_<Module>/web/css
◉ web/css - styles-m.less, styles-l.less, _styles.less
Include CSS
how stylesheets are preprocessed and compiled to CSS
◉ Server-side LESS compilation
default compilation mode, only option for production mode, Compilation
performed server, using the LESS PHP library.
◉ Client-side LESS compilation
When your application is not in the production mode, you can set Magento
to compile .less files in a browse
Backend : Stores > Configuration > ADVANCED > Developer [Store View drop-down field,
select Default Config.] Front-end development workflow, in the Workflow type
Preprocessor (LESS)
The Magento UI library is a flexible LESS-based frontend library designed
to assist Magento theme developers
● actions-toolbar
● breadcrumbs
● buttons
● drop-downs
● Forms.. And so on
Magento UI Library
You can find the Magento UI library under lib/web/css.
Magento UI Library location
Any questions ?
Appreciate your participation !!
Thanks!
◉ Magento 2 frontend developers guide
◉ Sessiondigital & Inchoo articles
Credit
◉Presentation template by SlidesCarnival
◉Prepared slides using Google Slides
Frontend Demo: https://iwdagency.com/magento2/
Backend Demo: https://iwdagency.com/magento2/admin/
User: demo
Pass: demo123
Reference

More Related Content

What's hot

Why NextCMS: Layout Editor
Why NextCMS: Layout EditorWhy NextCMS: Layout Editor
Why NextCMS: Layout Editor
Phuoc Nguyen Huu
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
Mage Guru
 
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
 
Unit 2.10 - Frames
Unit 2.10 - FramesUnit 2.10 - Frames
Unit 2.10 - Frames
Intan Jameel
 
Less & RequireJS - Frontend Development in Magento 2
Less & RequireJS - Frontend Development in Magento 2Less & RequireJS - Frontend Development in Magento 2
Less & RequireJS - Frontend Development in Magento 2
Arjen Miedema
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
Trọng Huỳnh
 
Magento20100226
Magento20100226Magento20100226
Magento20100226
Hirokazu Nishi
 
Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...
Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...
Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...
Meet Magento Italy
 
Magento20100313
Magento20100313Magento20100313
Magento20100313
Hirokazu Nishi
 
Basic html
Basic htmlBasic html
Basic html
Arun kumar
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
WebStackAcademy
 

What's hot (11)

Why NextCMS: Layout Editor
Why NextCMS: Layout EditorWhy NextCMS: Layout Editor
Why NextCMS: Layout Editor
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
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
 
Unit 2.10 - Frames
Unit 2.10 - FramesUnit 2.10 - Frames
Unit 2.10 - Frames
 
Less & RequireJS - Frontend Development in Magento 2
Less & RequireJS - Frontend Development in Magento 2Less & RequireJS - Frontend Development in Magento 2
Less & RequireJS - Frontend Development in Magento 2
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
 
Magento20100226
Magento20100226Magento20100226
Magento20100226
 
Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...
Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...
Francesco Zoccarato - Configuratori prodotto: soluzioni e tecniche per un'imp...
 
Magento20100313
Magento20100313Magento20100313
Magento20100313
 
Basic html
Basic htmlBasic html
Basic html
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
 

Viewers also liked

Ves Beat – magento 2 templates
Ves Beat – magento 2 templatesVes Beat – magento 2 templates
Ves Beat – magento 2 templates
Bùi Quỳnh
 
Magento 2 UI Components Overview
Magento 2 UI Components OverviewMagento 2 UI Components Overview
Magento 2 UI Components Overview
eGlobe IT Solutions
 
How to create a magento controller in magento extension
How to create a magento controller in magento extensionHow to create a magento controller in magento extension
How to create a magento controller in magento extension
Hendy Irawan
 
Front End Development in Magento
Front End Development in MagentoFront End Development in Magento
Front End Development in Magento
Eric Landmann
 
Magento Presentation Layer
Magento Presentation LayerMagento Presentation Layer
Magento Presentation Layer
Volodymyr Kublytskyi
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2
Magestore
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2
Mathew Beane
 

Viewers also liked (7)

Ves Beat – magento 2 templates
Ves Beat – magento 2 templatesVes Beat – magento 2 templates
Ves Beat – magento 2 templates
 
Magento 2 UI Components Overview
Magento 2 UI Components OverviewMagento 2 UI Components Overview
Magento 2 UI Components Overview
 
How to create a magento controller in magento extension
How to create a magento controller in magento extensionHow to create a magento controller in magento extension
How to create a magento controller in magento extension
 
Front End Development in Magento
Front End Development in MagentoFront End Development in Magento
Front End Development in Magento
 
Magento Presentation Layer
Magento Presentation LayerMagento Presentation Layer
Magento Presentation Layer
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2
 

Similar to Magento 2 theming - knowledge sharing session by suman kc

Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extension
Bun Danny
 
Creating a basic joomla
Creating a basic joomlaCreating a basic joomla
Creating a basic joomla
shailendra vishwakarma
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for website
Odoo
 
Designing for magento
Designing for magentoDesigning for magento
Designing for magento
hainutemicute
 
Joomla Beginner Template Presentation
Joomla Beginner Template PresentationJoomla Beginner Template Presentation
Joomla Beginner Template Presentation
alledia
 
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Iasi code camp 12 october 2013   shadow dom - mihai bîrsanIasi code camp 12 october 2013   shadow dom - mihai bîrsan
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Codecamp Romania
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
Christopher Ross
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
Kapil Dev Singh
 
Best practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghelaBest practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghela
vijaygolani
 
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
Don Cranford
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic Templates
Andy Wallace
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic Templates
Chris Davenport
 
Joomla Templates101
Joomla Templates101Joomla Templates101
Joomla Templates101
Barb Ackemann
 
46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world
hemi46h
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
Alessandro Molina
 
Magento x codekit x sass x compass x skeleton responsive grid
Magento x codekit x sass x compass x skeleton responsive gridMagento x codekit x sass x compass x skeleton responsive grid
Magento x codekit x sass x compass x skeleton responsive grid
Arush Sehgal
 
hellowired_instructions
hellowired_instructionshellowired_instructions
hellowired_instructions
AlexAnderson360
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013
Thomas Daly
 
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the BasicsUpgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Heather Wozniak
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
Kyle Cearley
 

Similar to Magento 2 theming - knowledge sharing session by suman kc (20)

Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extension
 
Creating a basic joomla
Creating a basic joomlaCreating a basic joomla
Creating a basic joomla
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for website
 
Designing for magento
Designing for magentoDesigning for magento
Designing for magento
 
Joomla Beginner Template Presentation
Joomla Beginner Template PresentationJoomla Beginner Template Presentation
Joomla Beginner Template Presentation
 
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Iasi code camp 12 october 2013   shadow dom - mihai bîrsanIasi code camp 12 october 2013   shadow dom - mihai bîrsan
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
 
Best practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghelaBest practice for magento theming by shrikant vaghela
Best practice for magento theming by shrikant vaghela
 
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
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic Templates
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic Templates
 
Joomla Templates101
Joomla Templates101Joomla Templates101
Joomla Templates101
 
46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Magento x codekit x sass x compass x skeleton responsive grid
Magento x codekit x sass x compass x skeleton responsive gridMagento x codekit x sass x compass x skeleton responsive grid
Magento x codekit x sass x compass x skeleton responsive grid
 
hellowired_instructions
hellowired_instructionshellowired_instructions
hellowired_instructions
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013
 
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the BasicsUpgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 

Recently uploaded

Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 

Recently uploaded (20)

Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 

Magento 2 theming - knowledge sharing session by suman kc

  • 1. This is Magento 2 Theming KSS (Knowledge sharing session) by Suman KC
  • 2. I am Suman KC Magento developer www.linkedin.com/in/sumankc www.sumankc.com Hello!
  • 4. Introduction Magento & Magento 2 intro leading to theming aspects 1
  • 6. 14K+ Files & 5K+ Folders That’s a lot of files & directory 109MBand that's before you add themes, modules and all your image libraries 300+ tablesProduct & category alone has 50+ tables relations Magento1.9.2
  • 7. Magento views are separated into Magento views LayoutsBlocks Templates
  • 9. 1. Prerequisites ◉ Not modify out of box Magento themes [Compatibility,upgradability & easy maintenance] ◉ Set magento application to developer mode [mode influences the way static files are cached] Creating a theme
  • 10. app/design/frontend/<Vendor>/ ├── <theme>/ │ ├── etc/ │ │ ├── view.xml │ ├── web/ │ │ ├── images │ │ │ ├── logo.svg │ ├── registration.php │ ├── theme.xml │ ├── composer.json Theme directory structure
  • 11. <theme_dir>/ ├── <Vendor>_<Module>/ │ ├── web/ │ │ ├── css/ │ │ │ ├── source/ │ ├── layout/ │ │ ├── override/ │ ├── templates/ ├── etc/ ├── i18n/ ├── media/ ├── web/ │ ├── css/ │ │ ├── source/ │ ├── fonts/ │ ├── images/ │ ├── js/ ├── composer.json ├── registration.php ├── theme.xml TypicalMagentotheme directory
  • 12. Apply a theme 1. In Admin, go to Stores > Configuration > Design. 2. In the Store View drop-down field, select the store view where you want to apply the theme. 3. On the Design Theme tab, select your newly created theme in the Design Theme drop-down. 4. Click Save Config. 5. If caching is enabled, clear the cache. 6. To see your changes applied, reload the store front pages. Configure a theme (admin section)
  • 13. The properties of product images used on the storefront are stored in the view.xml configuration file. <theme_dir>/etc/view.xml Image properties are configured for each image type defined by the id and type attributes of the <image> element: <images module="Magento_Catalog"> <image id="unique_image_id" type="image_type">...</image> <images/> Configure image properties
  • 14. ◉ Set a parent theme ◉ Override view.xml file ◉ Override static assets Theme inheritance ◉ Override templates ◉ Extend Layouts ◉ Override Layouts
  • 15. ◉ Current theme static files: <theme_dir>/web/ ◉ Ancestor’s static files, recursively, until a theme with no parent is reached: <parent_theme_dir>/web/ Module context ◉ Current theme module static files <theme_dir>/<Namespace>_<Module>/web/ ◉ Ancestor themes module static files, recursively, until a theme with no ancestor is reached: <parent_theme_dir>/<Namespace>_<Module>/web/ Override static assets
  • 16. Fallback schema ◉ Current theme templates: <theme_dir>/<Namespace>_<Module>/templates ◉ Ancestors themes templates, recursively, until a theme with no ancestor is reached: <parent_theme_dir>/<Namespace>_<Module>/templates ◉ Module templates: <module_dir>/view/frontend/templates Override templates
  • 17. The system collects layout files in the following order ◉ Current theme layouts: <theme_dir>/<Vendor>_<Module>/layout/ ◉ Ancestors themes <parent_theme_dir>/<Vendor>_<Module>/layout/ ◉ Module templates: <module_dir>/view/frontend/templates ◉ Module layouts for the frontend area: <module_dir>/view/frontend/layout/ ◉ Module layouts for the base area: <module_dir>/view/base/layout/ Extend Layouts
  • 18. To override the instructions from an ancestor theme layout file: ● Create a layout file with the same name in the <theme_dir>/<Vendor>_<Module>/layout/override/theme/<Vendor>/ <ancestor_theme> directory. *Though overriding layouts is not recommended, it is still possible, and might be a solution for certain customization tasks. Overriding Layouts
  • 20. ◉NO local.xml file - to modify, make a new xml file with same name ◉All attributes & definitions from origianl module will be inherited ◉move action - great feature of new XML ◉Structural & content blocks to containers & blocks Layouts
  • 21. ◉ Common layout instructions to customize layout Layout instructions ◉<block> ◉<container> ◉<before> & <after> ◉<action> ◉<referenceBlock> and <referenceContainer > ◉<move> ◉<remove> ◉<update> ◉<argument>
  • 22. ◉ Container is a structure without content which holds other blocks and containers ◉ You can specify HTML attributes... ◉ When extending, we have referenceBlock & referenceContainer Containers and blocks
  • 23. ◉ Updates in <referenceBlock> & <referenceContainer> are applied to the corresponding <block> or <container>. ◉ Eg. if you make a reference by <referenceBlock name=”right”>, you are targeting the block <block name=”right”> ◉ Attributes = remove & display, values = true/false ◉ <referenceBlock name="block.name" remove="true" /> <referenceBlock> & <referenceContainer>
  • 24. ◉ <move> helps moving elements to other location without the need to unset or removing from one place <move element="name.of.an.element" destination="name.of.destination.element" as="new_alias" after="name.of.element.after" before="name.of.element.before"/> ◉ <remove> to remove static resource linked in a page <head and to remove blocks & containers <head> <!-- Remove local resources --> <remove src="css/styles-m.css" /> <move> & <remove>
  • 27. Overriding layouts (from parent theme)
  • 28. 1. Set page layout <page layout="2columns-left" xmlns:xsi="" xsi:noNamespaceSchemaLocation=""> ... </page> 2. Include/remove static resources <page xmlns:xsi="" xsi:noNamespaceSchemaLocation=""> <head> <!-- Add local resources --> <css src="css/my-styles.css"/> <css src="css/ie-9.css" ie_condition="IE 9" /> <remove src="my-js.js" Layout Customization examples
  • 29. 3. Create a container - Reference a container <container name="some.container" as="someContainer" label="Some Container" htmlTag="div" htmlClass="some-container" /> <referenceContainer name="header.panel"> <block class="MagentoFrameworkView…”>....</block> 4. Create a block - Reference block <block class="MagentoCatalogBlockProductViewDescription" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type"> <arguments>...</arguments> </block> <referenceBlock name="logo">...</referenceBlock> Layout Customization examples
  • 31. ◉ Template hint - to locate template(store> config > advanced > developer > debug > enable template) ◉ Copy template to your theme following convention ◉ Make required changes For eg. form inside <Magento_Review_module_dir>/view/frontend/templates/form.phtml app/design/frontend/OrangeCo/orange/Magento_Review/templates Template customization walkthrough
  • 32. ◉ Templates are usually initiated in layout files. ◉ Each layout block has an associated template. ◉ The template is specified in the template attribute of the layout instruction. For example, from <Magento_Catalog_module_dir>/view/frontend/layout/catalog_category_view.xml : <block class="MagentoCatalogBlockCategoryView" name="category.image" template="Magento_Catalog::category/image.phtml"/> Template initiation
  • 33. Templates are stored in the following locations: ● Module templates: <module_dir>/view/frontend/templates/<path_to_templates> ● Theme templates: <theme_dir>/<Namespace>_<Module>/templates/<path_to_templates> Conventional template location
  • 34. Customize email templates using theme ◉ Template fallback is supported for email templates ◉ For eg, to override the New Order email template, create a template named order_new.html in the <theme_dir>/Magento_Sales/email ◉ Customize using Magento Admin ◉ In the Magento Admin, navigate to MARKETING > Communications > Email Templates ◉ Click Add New Template. Customizing email templates
  • 35. CSS Include, preprocessor & Magento UI Library 5
  • 36. In the Magento application, CSS files are included in layout files. ◉ Include css in <Magento_Blank_theme_dir>/Magento_Theme/layout/default_head_blocks.xml ◉ <page xmlns:xsi="" xsi:noNamespaceSchemaLocation=""> <head> <css src="css/styles-m.css" /> ◉ Module-specific styles - /<Namespace>_<Module>/web/css ◉ web/css - styles-m.less, styles-l.less, _styles.less Include CSS
  • 37. how stylesheets are preprocessed and compiled to CSS ◉ Server-side LESS compilation default compilation mode, only option for production mode, Compilation performed server, using the LESS PHP library. ◉ Client-side LESS compilation When your application is not in the production mode, you can set Magento to compile .less files in a browse Backend : Stores > Configuration > ADVANCED > Developer [Store View drop-down field, select Default Config.] Front-end development workflow, in the Workflow type Preprocessor (LESS)
  • 38. The Magento UI library is a flexible LESS-based frontend library designed to assist Magento theme developers ● actions-toolbar ● breadcrumbs ● buttons ● drop-downs ● Forms.. And so on Magento UI Library
  • 39. You can find the Magento UI library under lib/web/css. Magento UI Library location
  • 40. Any questions ? Appreciate your participation !! Thanks!
  • 41. ◉ Magento 2 frontend developers guide ◉ Sessiondigital & Inchoo articles Credit ◉Presentation template by SlidesCarnival ◉Prepared slides using Google Slides Frontend Demo: https://iwdagency.com/magento2/ Backend Demo: https://iwdagency.com/magento2/admin/ User: demo Pass: demo123 Reference

Editor's Notes

  1. Eg. of background image override app/design/frontend/OrangeCo/orange/web/images/background.jpg
  2. Eg. of background image override app/design/frontend/OrangeCo/orange/web/images/background.jpg
  3. Eg. of background image override app/design/frontend/OrangeCo/orange/web/images/background.jpg
  4. Eg. of background image override app/design/frontend/OrangeCo/orange/web/images/background.jpg