Building Magento-powered stores can be a challenging task. It requires a great range of technical skills that are related to the PHP/JavaScript programing language, development and production environments, and numerous Magento-specific features. This book will provide necessary insights into the building blocks of Magento.
By the end of this book, you should be familiar with configuration files, the dependency injection, models, collections, blocks, controllers, events, observers, plugins, cron jobs, shipping methods, payment methods, and a few other things. All of these should form a solid foundation for your development journey later on.
Chapter 1, Understanding the Platform Architecture, gives a high-level overview of the technology stack, architectural layers, top-level system structure, and individual module structure.
Chapter 2, Managing the Environment, gives an introduction to VirtualBox, Vagrant, and Amazon AWS as platforms to set up development and production environments. It further provides hands-on examples to set up/script Vagrant and Amazon EC2 boxes.
Chapter 3, Programing Concepts and Conventions, introduces readers to a few seemingly unrelated but important parts of Magento, such as composer, service contracts, code generation, the var directory, and finally, coding standards.
Chapter 4, Models and Collections, takes a look into models, resources, collections, schemas, and data scripts. It also shows the practical CRUD actions that are applied to an entity alongside filtering collections.
Chapter 5, Using the Dependency Injection, guides readers through the dependency injection mechanism. It explains the role of an object manager, how to configure class preferences, and how to use virtual types.
Chapter 6, Plugins, gives a detailed insight into the powerful new concept called plugins. It shows how easy it is to extend, or add to, an existing functionality using the before/after/around listeners.
Chapter 7, Backend Development, takes readers through a hands-on approach to what is mostly considered backend-related development bits. These involve cron jobs, notification messages, sessions, cookies, logging, profiler, events, cache, widgets, and so on.
Chapter 8, Frontend Development, uses a higher-level approach to guide the reader through what is mostly considered frontend-related development. It touches on rendering the flow, view elements, blocks, templates, layouts, themes, CSS, and JavaScript in Magento.
Chapter 9, The Web API, takes up a detailed approach to the powerful Web API provided by Magento. It gives hands-on practical examples to create and use both REST and SOAP, either through the PHP cURL library, or from the console.
Chapter 10, The Major Functional Areas, adopts a high-level approach towards introducing readers with some of the most common sections of Magento. These include CMS, catalog and customer management, and products and customer import. It even shows how to create a custom product type and a shipping and payment method.
Chapter 11, Testing, gives an overview of the types of test that are available in Magento. It further shows how to write and execute a custom test.
Chapter 12, Building a Module from Scratch, shows the entire process of developing a module, which uses most of the features introduced in the previous chapters. The final result is a module that has admin and storefront interface, an admin configuration area, e-mail templates, installed schema scripts, tests, and so on.
In order to successfully run all the examples provided in this book, you will need either your own web server or a third-party web hosting solution. The high-level technology stack includes PHP, Apache/Nginx, and MySQL. The Magento 2 Community Edition platform itself comes with a detailed list of system requirements that can be found at http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html. The actual environment setup is explained in Chapter 2, Managing the Environment.
This book is intended primarily for intermediate to professional PHP developers who are interested in Magento 2 development. For backend developers, several topics are covered that will enable you to modify and extend your Magento store. Frontend developers will also find some coverage on how to customize the look of a site in the frontend.
Given the massive code and structure changes, Magento version 2.x can be described as a platform that is significantly different from its predecessor. Keeping this in mind, this book will neither assume nor require previous knowledge of Magento 1.x.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The AbstractProductPlugin1
class does not have to be extended from another class for the plugin to work."
A block of code is set as follows:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework: ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Block\Product\AbstractProduct"> <plugin name="foggyPlugin1" type="Foggyline\Plugged\Block\Catalog\Product\ AbstractProductPlugin1" disabled="false" sortOrder="100"/> <plugin name="foggyPlugin2" type="Foggyline\Plugged\Block\Catalog\Product\ AbstractProductPlugin2" disabled="false" sortOrder="200"/> <plugin name="foggyPlugin3" type="Foggyline\Plugged\Block\Catalog\Product\ AbstractProductPlugin3" disabled="false" sortOrder="300"/> </type> </config>
Any command-line input or output is written as follows:
php bin/magento setup:upgrade
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In the Store View drop-down field, we select the store view where we want to apply the theme."
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>
, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>
, and we will do our best to address the problem.