Introduction to Magento Architecture
The following article provides an outline of Magento Architecture. Even if you do not know more about the Zend framework you can learn it as it is completely MVC pattern and have full utilization of Object-oriented approach. Magento uses a PHP object-oriented approach. Here we are going to learn a few important things like modularity, Security, MVS, Extensibility of Magento, etc.
Architecture of Magento
We can divide Magento architecture into two parts One is Magento internal architecture and another one is Magento ERP or UI architecture. The general architecture of Magento from request to response for internal architecture is given below.
- Magento Internal Architecture
- Magento ERP Architecture
Magento Internal Architecture
Given below are Magento internal architecture:
1. User-Agent: A user agent is software from which any request is made to Magento and that the software is capable of reading the response from the Magento. The response can be HTML format. Examples of some user agents are like a web browser(chrome, opera, etc). The user-agent section is the front part of the application, it could be a web application visible to customers.
2. Bootstrap: Bootstrap creates environments for the Magento app for running it. At first, it will check and sets few things like, PHP version, the setting of error reporting, defining the base path, initialize and invoking of the autoloader.
Below are some tasks performed by bootstrap:
- Check for the version of PHP (display error if the version is lower than 5.5), setting of default error, defining path (like root directories), running autoloader and setting of time zone, etc.
- Object manager initialization, fetching the main configuration from /app/etc/config.php
- Launch the application, by getting controller instance and call routing dispatch function.
3. Routing: In Magento routing play an important role, it has the algorithm where it will be decided which controller will be dispatched.
Before dispatch, it will go through several steps like:
Fetch active Routers—>Search for the requested controller and action—>After that find exact request controller and action an interpreter class file —>new dispatch function of interpreter class will be called.
4. Controller: After routing was able to decide which controller function need to call, that particular action of the controller will be invoked. This invoked function can call to model for any particular data, as the model contains business logic. Once the controller function will get data from the model it can either bind data with a view of HTML with a specific design or it can simply return according to requirements.
5. Model: The model is the place where we can write our business logic. The business logic like getting order details and calculation of the sum of the total amount and any discount will be calculated here only.
6. Mysql: This is the section where we are storing our all important data. These data are users details, user orders detail many important items.
7. View: This section contains all the HTML and CSS styles. It also added less from the magento2. It gets data from the controller and binds that data with html and CSS. After binding data with HTML and CSS, it will be returned to the respective controller action which called it.
8. HTTP Response: This section contains the final response for the requested user agent.
9. Security Work: Magento provides better security to resources from unwanted users and calls.
They are given below:
- User password encrypted while transmitted, it means the unencrypted password is not allowed to transmit.
- Salted hash has been used to store user passwords, which makes it harder for anyone to decrypt.
- For any kind of Audit and review of the customer, log files of activity are available admin or any authorized user can see all the activity and work performed by any end customer.
- Logs are stored very securely.
10. Magento API: Magento 2 comes with SOAP and REST API. From the Magento 2, it stopped supporting XML-RPC concepts. When an HTTP request comes from any URL, first it will come to the routing system where it will decide for the controller and action of the controller for dispatch. It will use the Mage_Api module.
Magento ERP Architecture
Magento ERP section is the section from where we can control the complete flow of the front end which is visible to customers. There are several important sections of any ERP system in the Magento system they are given below.
1. Sales: In sales, we can manage all the orders. Here managing orders means we can see who made the orders and who has paid and whose payment is still pending. It also allows us to download orders report for analysis purposes.
2. Catalog: This section contains the management of products. It allows us to add new products. In this section, we can also add categories. We can associate any product in any category. We can disable any product and we can add images for the products. This section gives power to Magento admin to control layout and visibility related to products to end customers. Admin can also see reviews and ratings for the products.
3. Customers: You must have registered with many e-commerce applications like Amazon and Flipkart etc. All these platforms capture your details and store them to their end. In Magento Customer section also store the customer details in the same way. These details may be, customer name, phone number, email, etc. From here we can disable enable or send any specific notification to any specific customers.
4.Promotions: In this section, a Magento admin can set some notification of the website for all end customers and users. These notifications can be like upcoming discounts, upcoming products, and events.
5. CMS: It allows Magento admin to manage all the static blocks of websites. It can be like the layout of the footer and layout of headers etc.
6. Reports: You can generate reports for monthly weekly orders by all customers. you can generate a report of orders for any specific customers etc.
7. System: It allows the Magento admin to define some system-level configuration. This configuration may be about enabling disabling any services for any particular attributes etc.
This has been a guide to Magento Architecture. Here we discuss the introduction and various architecture of Magento. You may also have a look at the following articles to learn more –