Magento 2 - Getting started.
-
Upload
aneesh-sreedharan -
Category
Documents
-
view
495 -
download
0
Transcript of Magento 2 - Getting started.
Overview of Magento
• E-commerce software• Start by Varien• Evolving• Buying of eBay• Magento 2.0
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
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
Getting started, Installation
• Download directly• Use composer (use packagist.org for packages)
• Authentication keys - username – public key, password – private key
Setup wizard, installation
Completing installation
• Empty pub/static folder in win server php <path to >bin/magento setup:static-content:deploy
Admin area
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
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
Folder structure comparison
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.
Creating a theme directory• <your install dir>/app/design/frontend/<Vendor>/<theme_name>
Declare the theme• Copy vendor/magento/theme-frontend-blank/theme.xml to
app/design/frontend/<Vendor>/<theme_name>
• * optionally make it a composer package
Add registration.php• Create a file registration.php in
app/design/frontend/<Vendor>/<theme_name>
Configure product images• Create /etc/ folder in theme directory• Copy view.xml from existing theme like Magento-frontend-blank
Create directories for static files
Theme created - activation
How to find the templates
How to find the templates
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
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>
Layout handling with xml files
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
Overriding a module layout
Overriding a theme layout
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
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>
Creating custom module• Add composer.json file
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
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
Custom module – Routes
• Create a routes.xml file
• domain.com/hello_world/awesome/life
Custom module - Controllers
• Create a controller file
• domain.com/hello_world/awesome/life
Some interesting features
• Color swatches made easy• Javascript - jQuery• Performance - Varnish cache support• Improved checkout process• Backup/Rollback system• Admin UI
Resources
• http://devdocs.magento.com/• http://alanstorm.com/category/magento• http://inchoo.net/• http://laracasts.com