SlideShare a Scribd company logo
Magento 2 Frontend Development
Confidential
Kapil Dev Singh
Confidential
Content
1. Magento 2 and scope for frontend development
2. Elements & File Structure
3. Theme Building
○ New or Git clone
○ Naming convention
○ Registration
○ Deployment
○ Compiling
○ presentation layer
Confidential
Magento 2 and scope for frontend development
● Magento 2 means Magento now onwards
● e-Commerce, MVC, CMS, PHP, MySQL
○ Magento Backend
○ Magento Frontend
○ Magento Development
● Frontend is described independent section and has a vast scope for frontend
developers.
Get involved as a resource than a support.
● Responsibilities of writing code and setting layouts and design proper.
Confidential
Elements
● Vendor, Theme and Module
● Vendor - core modules of magento resides in folder
○ Core Modules
○ Default Blank Theme
■ Core theme, based on RWD
○ Default Luma Theme
■ Demo theme provided and extended version of Blank Theme
Confidential
New or Git clone
● Install from ZIP file
● Install using composer(recommended)
○ Composer - Dependency Manager in PHP
○ Access Keys - Install and update Magento packages/extensions Bought from marketplace
○ The permissions - Owner, webuser and end user
● Create Database in phpmyadmin
● Run Magento on web browser and follow the installation steps
● Run deploy command and provide permission
>_ your_magento_dir > php bin/magento setup:static-content:deploy -f
>_ your_magento_dir > sudo chmod -R 777 var/ pub/ generated/
Confidential
File Structure
app - All Custom Modules will go in
/design/ - Theme directories
app/design/frontend/vendor/themeName
/code/ - Develop custom Magento code
/etc/env.php
bin - Magento command line script
lib - Separately packed libraries from Magento core
pub - All static file, Publicly accessible files
var - caches,logs and minified compiled template files
vendor – core modules defined in composer.json
(If magento is installed using composer)
Confidential
Declare New Theme
{{magento_root}} > app > design > frontend > vendor > theme_dir >
theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd
">
<title>New theme</title>
<parent>Magento/Luma</parent>
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
Confidential
Register Theme
{{magento_root}} > app > design > frontend > vendor > theme_dir >
registration.php
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::THEME,
'frontend/<Vendor>/<theme>',
__DIR__
);
Confidential
Configure Theme
In Admin, go to CONTENT > Design > Configuration. A Design Configuration page is opened. It
contains a grid with the available configuration scopes
Confidential
Configure Theme
In the configuration record corresponding to your store view, click Edit. The page with design
configuration for the selected scope is opened
Confidential
Include pre compliled Stylesheet/ CSS
Go to
Theme_dir > moduel_dir > layout > default_head_blocks.xml
Place the file in
Theme_dir > web >
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configur
ation.xsd">
<head>
<css src="css/owl-carousel.min.css" />
<css src="css/custom.css" />
<script src="js/wow.min.js"/>
</head>
</page>
Confidential
Confidential
Environment Setup
>_ cd projectName
>_ projectname> php bin/magento
>_ projectname> php bin/magento deploy:mode:show
>_ projectname> php bin/magento deploy:mode:set developer
>_ projectname> php bin/magento cache:flush
>_ projectname> php bin/magento cache:clean
>_ projectname> php bin/magento setup:upgrade
>_ projectname> php bin/magento setup:static-content:deploy -f
>_ projectname> php bin/magento dev:template-hints:enable
>_ projectname> sudo chmod -R 777 var/ pub/ generated/
Confidential
Grunt
/***** Ubuntu command for Node Js Installation *****************/
>_ sudo apt-get install -y nodejs
/*********************************************************/
>_ projectname> npm install grunt grunt-cli
>_ projectname> npm install
>_ projectname> npm update
Confidential
Add theme to grunt configuration
srctheme: {
area: 'frontend',
name: 'Ranosys/srctheme',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
},
>_ your_magento_dir > grunt exec:<theme>
>_ your_magento_dir > sudo chmod -R 777
var/ pub/ generated/
>_ your_magento_dir > grunt less:<theme>
dev > tools > grunt > configs > theme.js
Confidential
Less files
● _theme.less - override variable and create own theme variables
● _module.less - overwrite variables and styles ( new declarations )
● _extend.less - inherit parent styles, override existing styles
● _ui-component_extend.less -
○ _colors_extend.less
○ _typography_extend.less
○ _minicart_extend.less
● Import component extend files in to _extend.less using @import
@import 'module/_minicart_extend.less';
@import 'module/_cart_extend.less';
Confidential
Fall backs ( Hierarchy )
● Custom theme module
● app/code custom modules (if applicable)
● Parent theme module
● Parent’s Parent theme module
● Magento core modules( Layouts XML and phtml files)
● lib/web directory
Confidential
Fall backs ( Hierarchy )
Confidential
Confidential
Page Layout and Page Configuration
● Page Layout - Describe page wireframe, the outer structure (1 column, 2 column-left etc)
Core module - module_dir > view > frontend > page_layout
Theme DIR - theme_dir > Module_dir > page_layout
● Page Configuration - Declaration of the content and its meta information (Header, Section etc)
Core module - module_dir > view > frontend > layout
Theme DIR - theme_dir > Module_dir > layout
● Same fallback mechanism works for the template(.phtml) files
Core module - module_dir > view > frontend > templates
Theme DIR - theme_dir > Module_dir > templates
Confidential
Static Block, Widget, XML (Layouts)
● Static Block - small sections add or move separately
● Container - Structural element, use to create html elements by XML
<referenceContainer name="page.wrapper">
<container name="bs.hp.row" as="bs_hp_row"
label="Bootstrap HomePage Main Category Row" htmlTag="div"
htmlClass="src-home-cat-block" before="main.content">
<block class="MagentoCmsBlockBlock" name="category_promo">
<arguments>
<argument name="block_id" xsi:type="string">category_promo</argument>
</arguments>
</block>
</container>
</referenceContainer>
Confidential
<move element="store.settings.language" destination="header.container"
as="store_settings_language"/>
<move element="store.settings.language" destination="header.container"
as="store_settings_language" before="breadcrumb"/>
<move element="store.settings.language" destination="header.container"
as="store_settings_language" after="-"/>
<referenceBlock name="block_name" remove="true"/>
<referenceContainer name="content">
<block class="VendorModuleBlockTestTest" as="testali"
template="test/testali.phtml"/> </block>
</referenceContainer>
THANK YOU
Query
Confidential

More Related Content

Similar to Magento2 frontend development

Magento 2 Front end Development in detail
Magento 2   Front end Development in detail Magento 2   Front end Development in detail
Magento 2 Front end Development in detail
Kapil Dev Singh
 
Magento 2 - Getting started.
Magento 2 - Getting started.Magento 2 - Getting started.
Magento 2 - Getting started.
Aneesh Sreedharan
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
Mage Guru
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
Ravi Mehrotra
 
Mangento
MangentoMangento
Mangento
Ravi Mehrotra
 
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
Sergii Shymko
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of Magento
IRJET Journal
 
Magento 2 Code Migration Tool
Magento 2 Code Migration ToolMagento 2 Code Migration Tool
Magento 2 Code Migration Tool
Sergii Shymko
 
Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2
Meet Magento Italy
 
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
 
Introduction to Magento
Introduction to MagentoIntroduction to Magento
Introduction to Magento
Singapore PHP User Group
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
Trọng Huỳnh
 
Yoav Kutner Dutchento
Yoav Kutner DutchentoYoav Kutner Dutchento
Yoav Kutner Dutchento
Guido X Jansen
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
Claudio Procida
 
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
Magestore
 
Front End Development in Magento
Front End Development in MagentoFront End Development in Magento
Front End Development in Magento
Eric Landmann
 
Magento
MagentoMagento
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
Brian O'Gorman
 
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
 
Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2
Hanoi MagentoMeetup
 

Similar to Magento2 frontend development (20)

Magento 2 Front end Development in detail
Magento 2   Front end Development in detail Magento 2   Front end Development in detail
Magento 2 Front end Development in detail
 
Magento 2 - Getting started.
Magento 2 - Getting started.Magento 2 - Getting started.
Magento 2 - Getting started.
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Mangento
MangentoMangento
Mangento
 
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
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of Magento
 
Magento 2 Code Migration Tool
Magento 2 Code Migration ToolMagento 2 Code Migration Tool
Magento 2 Code Migration Tool
 
Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2
 
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
 
Introduction to Magento
Introduction to MagentoIntroduction to Magento
Introduction to Magento
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
 
Yoav Kutner Dutchento
Yoav Kutner DutchentoYoav Kutner Dutchento
Yoav Kutner Dutchento
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
 
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
 
Front End Development in Magento
Front End Development in MagentoFront End Development in Magento
Front End Development in Magento
 
Magento
MagentoMagento
Magento
 
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
SHOW202: How to customize Lotus Quickr Templates Using HTML, Javascript and C...
 
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
 
Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2
 

Recently uploaded

E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 

Recently uploaded (20)

E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 

Magento2 frontend development

  • 1. Magento 2 Frontend Development Confidential Kapil Dev Singh
  • 2. Confidential Content 1. Magento 2 and scope for frontend development 2. Elements & File Structure 3. Theme Building ○ New or Git clone ○ Naming convention ○ Registration ○ Deployment ○ Compiling ○ presentation layer
  • 3. Confidential Magento 2 and scope for frontend development ● Magento 2 means Magento now onwards ● e-Commerce, MVC, CMS, PHP, MySQL ○ Magento Backend ○ Magento Frontend ○ Magento Development ● Frontend is described independent section and has a vast scope for frontend developers. Get involved as a resource than a support. ● Responsibilities of writing code and setting layouts and design proper.
  • 4. Confidential Elements ● Vendor, Theme and Module ● Vendor - core modules of magento resides in folder ○ Core Modules ○ Default Blank Theme ■ Core theme, based on RWD ○ Default Luma Theme ■ Demo theme provided and extended version of Blank Theme
  • 5. Confidential New or Git clone ● Install from ZIP file ● Install using composer(recommended) ○ Composer - Dependency Manager in PHP ○ Access Keys - Install and update Magento packages/extensions Bought from marketplace ○ The permissions - Owner, webuser and end user ● Create Database in phpmyadmin ● Run Magento on web browser and follow the installation steps ● Run deploy command and provide permission >_ your_magento_dir > php bin/magento setup:static-content:deploy -f >_ your_magento_dir > sudo chmod -R 777 var/ pub/ generated/
  • 6. Confidential File Structure app - All Custom Modules will go in /design/ - Theme directories app/design/frontend/vendor/themeName /code/ - Develop custom Magento code /etc/env.php bin - Magento command line script lib - Separately packed libraries from Magento core pub - All static file, Publicly accessible files var - caches,logs and minified compiled template files vendor – core modules defined in composer.json (If magento is installed using composer)
  • 7. Confidential Declare New Theme {{magento_root}} > app > design > frontend > vendor > theme_dir > theme.xml <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd "> <title>New theme</title> <parent>Magento/Luma</parent> <media> <preview_image>media/preview.jpg</preview_image> </media> </theme>
  • 8. Confidential Register Theme {{magento_root}} > app > design > frontend > vendor > theme_dir > registration.php <?php /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ MagentoFrameworkComponentComponentRegistrar::register( MagentoFrameworkComponentComponentRegistrar::THEME, 'frontend/<Vendor>/<theme>', __DIR__ );
  • 9. Confidential Configure Theme In Admin, go to CONTENT > Design > Configuration. A Design Configuration page is opened. It contains a grid with the available configuration scopes
  • 10. Confidential Configure Theme In the configuration record corresponding to your store view, click Edit. The page with design configuration for the selected scope is opened
  • 11. Confidential Include pre compliled Stylesheet/ CSS Go to Theme_dir > moduel_dir > layout > default_head_blocks.xml Place the file in Theme_dir > web > <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configur ation.xsd"> <head> <css src="css/owl-carousel.min.css" /> <css src="css/custom.css" /> <script src="js/wow.min.js"/> </head> </page>
  • 13. Confidential Environment Setup >_ cd projectName >_ projectname> php bin/magento >_ projectname> php bin/magento deploy:mode:show >_ projectname> php bin/magento deploy:mode:set developer >_ projectname> php bin/magento cache:flush >_ projectname> php bin/magento cache:clean >_ projectname> php bin/magento setup:upgrade >_ projectname> php bin/magento setup:static-content:deploy -f >_ projectname> php bin/magento dev:template-hints:enable >_ projectname> sudo chmod -R 777 var/ pub/ generated/
  • 14. Confidential Grunt /***** Ubuntu command for Node Js Installation *****************/ >_ sudo apt-get install -y nodejs /*********************************************************/ >_ projectname> npm install grunt grunt-cli >_ projectname> npm install >_ projectname> npm update
  • 15. Confidential Add theme to grunt configuration srctheme: { area: 'frontend', name: 'Ranosys/srctheme', locale: 'en_US', files: [ 'css/styles-m', 'css/styles-l' ], dsl: 'less' }, >_ your_magento_dir > grunt exec:<theme> >_ your_magento_dir > sudo chmod -R 777 var/ pub/ generated/ >_ your_magento_dir > grunt less:<theme> dev > tools > grunt > configs > theme.js
  • 16. Confidential Less files ● _theme.less - override variable and create own theme variables ● _module.less - overwrite variables and styles ( new declarations ) ● _extend.less - inherit parent styles, override existing styles ● _ui-component_extend.less - ○ _colors_extend.less ○ _typography_extend.less ○ _minicart_extend.less ● Import component extend files in to _extend.less using @import @import 'module/_minicart_extend.less'; @import 'module/_cart_extend.less';
  • 17. Confidential Fall backs ( Hierarchy ) ● Custom theme module ● app/code custom modules (if applicable) ● Parent theme module ● Parent’s Parent theme module ● Magento core modules( Layouts XML and phtml files) ● lib/web directory
  • 20. Confidential Page Layout and Page Configuration ● Page Layout - Describe page wireframe, the outer structure (1 column, 2 column-left etc) Core module - module_dir > view > frontend > page_layout Theme DIR - theme_dir > Module_dir > page_layout ● Page Configuration - Declaration of the content and its meta information (Header, Section etc) Core module - module_dir > view > frontend > layout Theme DIR - theme_dir > Module_dir > layout ● Same fallback mechanism works for the template(.phtml) files Core module - module_dir > view > frontend > templates Theme DIR - theme_dir > Module_dir > templates
  • 21. Confidential Static Block, Widget, XML (Layouts) ● Static Block - small sections add or move separately ● Container - Structural element, use to create html elements by XML <referenceContainer name="page.wrapper"> <container name="bs.hp.row" as="bs_hp_row" label="Bootstrap HomePage Main Category Row" htmlTag="div" htmlClass="src-home-cat-block" before="main.content"> <block class="MagentoCmsBlockBlock" name="category_promo"> <arguments> <argument name="block_id" xsi:type="string">category_promo</argument> </arguments> </block> </container> </referenceContainer>
  • 22. Confidential <move element="store.settings.language" destination="header.container" as="store_settings_language"/> <move element="store.settings.language" destination="header.container" as="store_settings_language" before="breadcrumb"/> <move element="store.settings.language" destination="header.container" as="store_settings_language" after="-"/> <referenceBlock name="block_name" remove="true"/> <referenceContainer name="content"> <block class="VendorModuleBlockTestTest" as="testali" template="test/testali.phtml"/> </block> </referenceContainer>