SlideShare a Scribd company logo
1 of 23
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
 
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 ToolsSergii Shymko
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoIRJET Journal
 
Magento 2 Code Migration Tool
Magento 2 Code Migration ToolMagento 2 Code Migration Tool
Magento 2 Code Migration ToolSergii 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 2Meet 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 2Magestore
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookTrọng Huỳnh
 
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 DemystifiedClaudio 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 1Magestore
 
Front End Development in Magento
Front End Development in MagentoFront End Development in Magento
Front End Development in MagentoEric Landmann
 
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 vaghelavijaygolani
 
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 2Hanoi 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
 
Mangento
MangentoMangento
Mangento
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to 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

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 

Recently uploaded (20)

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 

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>