Magento 2 - Getting started.
-
Upload
aneesh-sreedharan -
Category
Documents
-
view
495 -
download
0
Transcript of Magento 2 - Getting started.
![Page 2: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/2.jpg)
Overview of Magento
• E-commerce software• Start by Varien• Evolving• Buying of eBay• Magento 2.0
![Page 3: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/3.jpg)
Why Magento 2
• Why magento 1 to 2 change? - Magento 1 gets matured. - integration with technologies that are current standard in development. Like use of composer - modular and extensible than before. - Better admin interfaces
• Opportunities - There’s in excess of 240,000 shops on Magento
![Page 4: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/4.jpg)
Magento 2 System requirements
• PHP version 5.5+• MySQL version 5.6.0+• PHP Extensions - PDO/MySQL, mbstring, mcrypt,
mhash, SimpleXML, curl, xsl, gd, ImageMagick 6.3.7 (or later) or both, soap, intl, bc-math,openssl
![Page 5: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/5.jpg)
Getting started, Installation
• Download directly• Use composer (use packagist.org for packages)
• Authentication keys - username – public key, password – private key
![Page 6: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/6.jpg)
Setup wizard, installation
![Page 7: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/7.jpg)
Completing installation
• Empty pub/static folder in win server php <path to >bin/magento setup:static-content:deploy
![Page 8: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/8.jpg)
Admin area
![Page 9: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/9.jpg)
Magento CLI
• Command-Line Interface• php <Magento install dir>/bin/magento <command name>
• php <Magento install dir>/bin/magento list• php <Magento install dir>/bin/magento sampledata:deploy• php <Magento install dir>/bin/magento setup:upgrade
![Page 10: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/10.jpg)
Main admin settings
• Stores > Configuration settings - General > Web - Base URL (secure and insecure) - General > Design – Theme selection - Sales > Checkout/shipping/Payment methods - Advanced > Developer – Debug- Enable template path hints
• System > Cache management• System > Index management• System > Web setup wizard
![Page 11: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/11.jpg)
Folder structure comparison
![Page 12: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/12.jpg)
Creating a theme• Create a directory for the theme
under app/design/frontend/<your_vendor_name>/<your_theme_name>.
• Add a declaration file theme.xml • optionally create etc directory and create a file
named view.xml.• Add a composer.json file.• Add registration.php.• Create directories for CSS, JavaScript, images, and fonts.• Configure your theme in the Admin panel.
![Page 13: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/13.jpg)
Creating a theme directory• <your install dir>/app/design/frontend/<Vendor>/<theme_name>
![Page 14: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/14.jpg)
Declare the theme• Copy vendor/magento/theme-frontend-blank/theme.xml to
app/design/frontend/<Vendor>/<theme_name>
• * optionally make it a composer package
![Page 15: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/15.jpg)
Add registration.php• Create a file registration.php in
app/design/frontend/<Vendor>/<theme_name>
![Page 16: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/16.jpg)
Configure product images• Create /etc/ folder in theme directory• Copy view.xml from existing theme like Magento-frontend-blank
![Page 17: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/17.jpg)
Create directories for static files
![Page 18: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/18.jpg)
Theme created - activation
![Page 19: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/19.jpg)
How to find the templates
![Page 20: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/20.jpg)
How to find the templates
![Page 21: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/21.jpg)
Overriding templates• Vendor/magento/module-checkout/view/frontend/templates/cart/
minicart.phtml • Copy to
app/design/frontend/Hatslogic/mytheme/Magento_Checkout/templates/cart/minicart.phtml
![Page 22: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/22.jpg)
Layout handling with xml files
• 1-column, 2column-left,-right, 3column• Magento uses xml files to handle page layout• vendor\magento\module-catalog\view\frontend\layout\ - <block> - <container> - before and after attributes - <referenceBlock> and <referenceContainer> - <move> - <argument>
![Page 23: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/23.jpg)
Layout handling with xml files
![Page 24: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/24.jpg)
Extending a layout• Extend Magento product view layout<Magento_Catalog_module_dir>/view/frontend/layout/catalog_product_view.xml<theme_dir>/Magento_Catalog/layout/catalog_product_view.xml
![Page 25: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/25.jpg)
Overriding a module layout
![Page 26: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/26.jpg)
Overriding a theme layout
![Page 27: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/27.jpg)
Creating a custom module• Create module in folder <magento
install>/app/code/<Vendor>/<ModuleName>
• Main folders of Module- Block- Controller- etc (contains module.xml)- Model- Setup- view
![Page 28: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/28.jpg)
Creating a custom module• Create module.xml in <install_dir>/app/code/<Vendor>/<Module>/etc/
• Create registration.php in <install_dir>/app/code/<Vendor>/<Module>
![Page 29: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/29.jpg)
Creating custom module• Add composer.json file
![Page 30: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/30.jpg)
Creating custom modules
# Enable a module php -f bin/magento module:enable Vendor_ModuleName
Php –f bin/magento module:enable Hatslogic_HelloWorld
# Update the setup/databasephp -f bin/magento setup:upgrade
Creates and entry in app/etc/config.php
![Page 31: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/31.jpg)
Enable custom module - Issues
# there are no commands defined in the module namespace - an issue in composer.json - an issue in module.xml - wrong config of registration.php
![Page 32: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/32.jpg)
Custom module – Routes
• Create a routes.xml file
• domain.com/hello_world/awesome/life
![Page 33: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/33.jpg)
Custom module - Controllers
• Create a controller file
• domain.com/hello_world/awesome/life
![Page 34: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/34.jpg)
Some interesting features
• Color swatches made easy• Javascript - jQuery• Performance - Varnish cache support• Improved checkout process• Backup/Rollback system• Admin UI
![Page 35: Magento 2 - Getting started.](https://reader033.fdocuments.us/reader033/viewer/2022051300/58f091391a28ab0e798b4599/html5/thumbnails/35.jpg)
Resources
• http://devdocs.magento.com/• http://alanstorm.com/category/magento• http://inchoo.net/• http://laracasts.com