Magento is a feature-rich open-source web application that was first released on March 31, 2008. Varien is the company behind Magento, responsible for the development and on-going maintenance of the platform. It is built based on Zend Framework.
There are many Magento extensions that you can find on Magento Connect. However, it may not always meet your needs. If you can understand Magento module structure, you are able to modify a module or even developing a new one.
In this entry, we will explore a structure of a basic Magento module and in the next entry I will show how to develop a simple module for Magento.
The basic structure of a module.
A sample structure of a magento module. ├── app │ ├── code │ │ └── local │ │ └── [Namespace] │ │ └── [Module] │ │ ├── Block │ │ ├── controllers │ │ │ └── IndexController.php │ │ ├── etc │ │ │ ├── adminhtml.xml │ │ │ ├── config.xml │ │ │ └── system.xml │ │ ├── Helper │ │ ├── Model │ │ │ ├── [Module].php │ │ │ ├── Customer.php │ │ │ ├── Mysql4 │ │ │ │ ├── [Module] │ │ │ │ │ └── Collection.php │ │ │ │ └── [Module].php │ │ │ ├── Observer.php │ │ │ └── Order.php │ │ │ │ │ └── sql │ │ └── [module]_setup │ │ └── mysql4-install-0.0.1.php │ └── etc │ └── modules │ └── [Namespace]_[Module].xml └── shell └── [module]-cli.php
Our module is put under the app/code folder. There are two important configuration files:
- app/etc/modules/<Namespace>_<Module>.xml
- This config file inform Magento about the existence of our module
- app/code/local/<Namespace>/<Module>/etc/config.xml
- This config file inform Magento about our module version, files (controllers, models, helpers etc) and many other things.
- app/code/local/[Namespace]/[Module]/etc
- This folder contain xml configuration files for your Magento module such as (see official document):
- config.xml
- This is the main config file of the module
- adminhtml.xml
- This file is used for declaring a sections in the left side of Magento admin settings in Sytem/Configuration.
- system.xml
- This file is used for declaring a custom settings elements (button, dropdown, textbox) for the module settings page.
- app/code/local/[Namespace]/[Module]/Blocks (see offical document)
- This folder store Block which is reusable components are used to build the Layout.
- app/code/local/[Namespace]/[Module]/controllers
- This folder stores controllers file (e.g:IndexController.php) likes Zend Framework structure.
- app/code/local/[Namespace]/[Module]/Helper
- This folder stores helpers file likes Zend Framework structure. It is common methods that is used to process objects and variables.
- app/code/local/[Namespace]/[Module]/Model
- This folder stores Model files likes Zend Framework structure.
- app/code/local/[Namespace]/[Module]/sql/[module]_setup
- This folder stores code that generates customer data for the module. It is executed when admin opens the admin settings page. The version behind the name of the script mysql4-install-0.0.1.php have to be identical with the version is declared in config.xml otherwise it is not run by Magento.
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
ReplyDeletelogo design company chennai