Magento 2 Development Quick Start Guide
eBook - ePub

Magento 2 Development Quick Start Guide

Build better stores by extending Magento

Branko Ajzele

  1. 218 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Magento 2 Development Quick Start Guide

Build better stores by extending Magento

Branko Ajzele

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Create an interactive online store and customize it further using Magento

Key Features

  • A straightforward guide to developing with Magento
  • Examples of different types of extension
  • Customize the Magento storefront and admin areas

Book Description

Magento is an open-source, enterprise-level e-commerce platform with unlimited scope for customization. This makes it a great choice not only for vendors but for developers as well.

This book guides you through Magento development, teaching you how to develop modules that extend or change its functionality, leading to more flexible and profitable Magento stores. You start with a structural overview of the key Magento development components.

You will learn where things such as plugins, events, models, controllers, layouts, and UI components ft into the development landscape. You will go through examples of using these components to extend Magento. As you progress, you will be building a diverse series of small but practical Magento modules.

By the end of this book, you will not only have a solid foundation in the Magento development architecture; but you will also have practical experience in developing modules to customize and extend Magento stores.

What you will learn

  • Develop a simple shipping module
  • Build admin interfaces with the built-in form and listing UI components
  • Implement JavaScript components for improved customer experience
  • Accommodate vendor needs by adding new catalog-related features
  • Develop your way to a better checkout
  • Improve customer interaction with new customer-related extensions
  • Create new web APIs to make your modules more extensible

Who this book is for

This book is for competent PHP developers, with only basic knowledge of the Magento platform required.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Magento 2 Development Quick Start Guide è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Magento 2 Development Quick Start Guide di Branko Ajzele in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatik e Content-Management-Systeme. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781789345469
Edizione
1
Argomento
Informatik

Understanding the Magento Architecture

Building web shops is a challenging and tedious job, and even more so if a platform you are working on is limited via features, extensibility, and the overall ecosystem it provides. Choosing the right platform can often make the difference between a project's success or failure. The abundance of available e-commerce software, from SaaS to self-hosted solutions, does not really make it an easy choice.
The Magento e-commerce platform has been around for over 10 years now. With its first stable release dating back to March 2008, it immediately caught the attention of developers as an extensible and feature-rich open source platform. Over time, Magento established itself as not just a stunning technical and feature-rich platform, but as a robust ecosystem as well. By allowing developers to validate their real-world skills through the Magento certification program, certain standards have been put into effect, making it easier for merchants to better recognize their solution partners. Training courses have been further provided for other roles in e-commerce business as well, such as merchants, marketers, system administrators, and business analysts.
In this chapter, we will take a look at some of the key must-knows about Magento:
  • Installing Magento
  • Modes
  • Areas
  • Request flow processing
  • Modules
  • Cache
  • Dependency injection
  • Plugins
  • Events and observers
  • Console commands
  • Cron jobs
To keep things compact as we move forward, let's assume the following throughout this book:
  • We are working on the magelicious.loc project
  • We are referring to our project root directory as <PROJECT_DIR>
  • We are referring to the <PROJECT_DIR>/app/code/Magelicious directory as <MAGELICIOUS_DIR>
  • We are referring to Magento's vendor/magento directory as <MAGENTO_DIR>
  • We have a running LAMP/MAMP/WAMP stack (Apache, MySQL, PHP) that is compliant with Magento's requirements
  • We have a Composer package manager installed
  • We have access to crontab (Linux, MacOS) or Task Scheduler (Windows)
AMPPS is an easy to use, all in one LAMP/MAMP/WAMP software stack from Softaculous, which enables Apache, MySQL, and PHP. With AMPPS, you can even install Magento 2.x by the click of a button, which means it comes loaded with all the right PHP extensions. While it isn't suited for production purposes, it comes in handy for quickly kicking the development environment. See http://www.ampps.com/ for more information. Consult the devdocs (https://devdocs.magento.com) for Magento technology stack requirements.

Technical requirements

You will need to have basic knowledge of PHP, OOP, JavaScript, and XML. You will also need Apache, MySQL, and AMPPS installed on your system to execute the codes.
The code files of this chapter can be found on GitHub:
https://github.com/PacktPublishing/Magento-2-Quick-Start-Guide.
Check out the following video to see the Code in Action:
http://bit.ly/2D8kOlF.

Installing Magento

The Magento platform comes in two flavors:
  • Magento Open Source: The free version, targeting small businesses
  • Magento Commerce: The commercial version, targeting small, medium, or enterprise businesses
The difference between the two comes mainly in the form of extra modules that were added to the Commerce version, whereas all the coding concepts and core features remain the same. It goes to say that any knowledge we obtain through following Magento Open Source examples is fully applicable to anyone working on Magento Commerce.
There are several ways that we can obtain source files for Magento Open Source:
  • Source file archive (.zip, .tar.gz, .tar.bz2), available at https://magento.com
  • Git repository, available at https://github.com/magento/magento2
  • Composer repository, available at https://repo.magento.com
Obtaining source files via a CLI from the composer repository is our preferred method. Assuming we are within the empty <PROJECT_DIR> directory, we can kick off this process via the following command:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
The dot (.) at the end of this command this tells the composer to pull the files into a current directory.
Once the Composer process is finished, we can start installing Magento. There are two ways we can install Magento:
  • Via the Web Setup Wizard: The graphical, browser-based process
  • Via the command line: The command-line-based process
Knowing how to install Magento via the command line is an essential skill in day-to-day development, as the majority of development requires the developer to tackle various bin/magento commands—not to mention the command line approach is somewhat faster and easily scripted.
Let's install Magento with the built-in php bin/magento setup:install command and a few of the required installation options as follows:
php bin/magento setup:install \
--db-host="/Applications/MAMP/tmp/mysql/mysql.sock" \
--db-name=magelicious \
--db-user=root
--db-password=root \
--admin-firstname=John \
--admin-lastname=Doe \
[email protected] \
--admin-user=john \
--admin-password=jrdJ%0i9a69n
After the preceding command has been executed, we should begin to see console progress, starting with something like the following:
Starting Magento installation:
File permissions check...
[Progress: 1 / 513]
Required extensions check...
[Progress: 2 / 513]
Enabling Maintenance Mode...
[Progress: 3 / 513]
Installing deployment configuration...
[Progress: 4 / 513]
Installing database schema:
Schema creation/updates:
Module 'Magento_Store':
[Progress: 5 / 513]
While it might take up to a few minutes, a successful installation should end with a message that's similar to the following:
[Progress: 508 / 513]
Installing admin user...
[Progress: 509 / 513]
Caches clearing:
Cache cleared successfully
[Progress: 510 / 513]
Disabling Maintenance Mode:
[Progress: 511 / 513]
Post installation file permissions check...
For security, remove write permissions from these directories: '/Users/branko/Projects/magelicious/app/etc'
[Progress: 512 / 513]
Write installation date...
[Progress: 513 / 513]
[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_mxq00c
Nothing to import.
Right after installation, our first step should be to set Magento to developer mode by using the following command:
php bin/magento deploy:mode:set developer
We will take a closer look at Magento modes soon; for now, this is to be taken as is.
Magento automatically assigns an admin URL during console installation, unless explicitly specified through the install command via the --backend-frontname option.
Out of all the installation options listed, only the following are actually required: --admin-firstname, --admin-lastname, --admin-email, --admin-user, and --admin-password. It is worth taking some time to read through the official Magento documentation (https://devdocs.magento.com) and looking at what the rest of the installation options have to offer.
If all went well during the Magento installation, we should be able to open the storefront and admin in our browser.

Modes

Modes play a crucial role in Magento's development and deployment processes. They are handled by the deploy module, which can be found under...

Indice dei contenuti

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Contributors
  5. Preface
  6. Understanding the Magento Architecture
  7. Working with Entities
  8. Understanding Web APIs
  9. Building and Distributing Extensions
  10. Developing for Admin
  11. Developing for Storefront
  12. Customizing Catalog Behavior
  13. Customizing Checkout Experiences
  14. Customizing Customer Interactions
  15. Other Books You May Enjoy
Stili delle citazioni per Magento 2 Development Quick Start Guide

APA 6 Citation

Ajzele, B. (2018). Magento 2 Development Quick Start Guide (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/823706/magento-2-development-quick-start-guide-build-better-stores-by-extending-magento-pdf (Original work published 2018)

Chicago Citation

Ajzele, Branko. (2018) 2018. Magento 2 Development Quick Start Guide. 1st ed. Packt Publishing. https://www.perlego.com/book/823706/magento-2-development-quick-start-guide-build-better-stores-by-extending-magento-pdf.

Harvard Citation

Ajzele, B. (2018) Magento 2 Development Quick Start Guide. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/823706/magento-2-development-quick-start-guide-build-better-stores-by-extending-magento-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Ajzele, Branko. Magento 2 Development Quick Start Guide. 1st ed. Packt Publishing, 2018. Web. 14 Oct. 2022.