Magento 101: A Technical Overview, Part 1
It’s been a couple of weeks since the Innovate 2011 conference ended, and there was so much incredible content that came out of it. In fact, it can be difficult to know where to start covering it. So, I’d like to break down some of the sessions that took place and give you a look […]
It’s been a couple of weeks since the Innovate 2011 conference ended, and there was so much incredible content that came out of it. In fact, it can be difficult to know where to start covering it. So, I’d like to break down some of the sessions that took place and give you a look into things you might have missed.
One of the main tracks at the event was the Magento track. And, since Magento is new to the eBay/PayPal lineup, we’ve already been spending some time with it. However, it’s such a large and powerful platform that I think it will be helpful for us to tackle some of the content and ideas presented at Innovate 2011 on this topic.
If you missed it, Dmitriy Soroka and Kevin Eichelberger created a great overview of the Magento platform called “Magento 101: A Technical Overview.” Dmitriy is the Magento system architect, and Kevin is the founder and CEO of Blue Acorn, an ecommerce, consulting, and development company, and a Magento partner. Below, I’ll run you through the highlights of the technical part of their session, complete with some screenshots from the presentation. However, I encourage you to watch it in its entirety (which you can do at the bottom of this article), as the last 30 minutes or so are focused primarily on the implications of the technical architecture on businesses.
The most recommended environment for installing and running Magento is to use Linux as your operating system, Apache as your web server, MySQL as your database, and PHP as your scripting environment (a setup also known as LAMP). It’s important to note that Magento also supports both Windows and nginx web servers. For databases, Magento also supports Microsoft SQL and Oracle SQL. Because Magento has always been highly adaptable and customizable, there are other possible combinations that will work for it as well.
- Zend Framework: This is an open source, object-oriented web application framework for PHP5. Often called a component library, it provides out-of-the-box functionality much like Rails does for Ruby.
- PEAR: An acronym for PHP Extension and Application Repository, this is a framework and distribution system for reusable PHP components.
- Apache Solr PHP Client: Solr-php-client is a PHP library used for indexing and searching documents within an Apache Solr installation. Solr is written in Java and runs as a standalone full-text search server within a servlet container.
As you can see in the diagram below, Magento has four main application layers: presentation, domain, data, and library. The core Magento framework and code libraries are part of the library layer; think of this as what’s under the hood of Magento. It’s usually best not to modify anything found in this layer, as it could impact future upgrades. The data layer is fairly self-explanatory—it’s where your data is access and stored. Modules you install will work with the data layer, the domain layer, and the presentation layer.
The domain layer works mostly with the data layer and holds all of the business logic. The domain layer retrieves the data from the data layer using the installed modules. These modules hold the information retrieved by the domain layer, and then pass the data for arranging and displaying to the presentation layer. Your themes or skins are a part of the presentation layer and actually display the data from the modules, which contain the information we would like to show our customers.
The Magento system architecture is based on the Model-View-Controller (MVC) pattern common to many other web frameworks.
Magento modules have five core components (though not all of them are required). They are:
- Configuration: This is the version information and indicates any dependencies on other modules. Blocks: In Magento, blocks are simple PHP classes. They provide a public interface to frontend developers and theme developers so they can get data from the business logic found in your domain layer.
- Models: Models implement two layers. They are responsible for business logic representation and access to data storage.
- Controllers: Controllers handle all of the requests coming to your module and provide access points for developers.
- Database schema: These scripts are necessary only if your module actually works with data stored in a database. They allow you to create, modify, and update tables based on the needs of your module.
From your customer’s view, your themes and skins are what will be shown first. Modules are displayed through your template, which can be easily modified or customized through simple HTML and CSS edits. Your template will define your business logic representation or the actual display and presentation of the products in your Magento store.
Magento extensions are a big part of the Magento system’s architecture. As a whole, they come as upgrades or a customization to the basic Magento setup. They can be installed to create new functionality and new features. Extensions include source files and instructions on how they are implemented, what files are needed, and where they are located on your server. Usually, when extensions are installed, they produce new modules for the customer, for the developer, or both. Note that themes are also considered extensions.
You can install an extension that will modify or improve the current payment and shipping functionality in your Magento installation. To expand upon the image above, let’s consider an example. Say you have three modules displaying your customer details. One module in your Magento system displays your customer’s personal information, another module displays your customer’s payment method, and a third module displays your customer’s preferred shipping method. Sometimes, the modules contain data or information unnecessary for your specific needs, such as your customer’s birth date, marital status, etc.
With the help of an extension you either create or install, you could produce just a single module (instead of three) that will display your customer’s name, billing and shipping address, phone number, and preferred payment method. The extension has enhanced your Magento system by picking out only the information you require at that time. This is just one overly simple example of how extensions improve the Magento platform. Other extensions involve improvements on your themes or product presentation, and just about anything that is necessary to meet your unique needs.
Customization is at the heart of why and how Magento was created. It allows Magento to serve different businesses, each having a unique business style, specific customers, and varied goals. Magento can cater to them all because it permits easy customization to its data structure by having module upgrade scripts that are available as extensions.
Magento’s customization does not end with using extensions to enhance your system. Magento is built to easily accept your own overrides to the controller actions, models, and blocks. If none of the extensions you find does specifically what you need for your Magento store, then you can introduce your own scripts by creating a new one or by tweaking existing models that are closest to your needs. Consider one example given during the Innovate presentation. Say the computation of your customer’s payment is different from what exists in your system. In this case, you can override the current model and make it possible for your system to calculate payment amounts specific to your needs.
Additionally, Magento has predefined extension points called event observers, which allow you to inject additional functionality needed for certain situations—for example, a new order being received. You can use that event to trigger additional processes or actions before computing for an expected payment. This action might be informing the customer of the availability of the ordered product, or simply checking whether the product has a discount.
Overrides also apply to viewing modules and blocks on your theme or template. By modifying the necessary HTML and CSS files, you can choose which blocks or modules to show and where to show them. Modifications or overrides include changing your theme’s logo image or color combinations, and anything else you can do with HTML and CSS.
Additionally, Magento provides resources for customizing your system. Magento Connect is a marketplace for Magento extensions. With over 4,800 extensions currently available to you, you can enhance your Magento installation’s functionality with ease. Also, because of Magento’s scalability and flexibility, the market for Magento developers is growing, creating a valuable opportunity for developers looking to expand their skill sets for the marketplace. However, even with limited knowledge of Magento, you will find it easy to work with and extend the functionality to meet your needs.
You may also watch it below if you prefer to have these notes up while viewing it.
There is so much to cover and so much to learn about Magento, as it truly is a powerful platform. I’ll continue to unpack these videos for you and offer highlights over the coming weeks. Don’t forget to share how you’re using Magento in the comments below.