Creating custom Magento module is little bit tricky and tough, specially if you are going with manual approach and creating every class and setting up every XML file. Because creating a simple Magento module requires lots of coding and configuration. In some scenario if you will type the XML node in the wrong case(i.e lower case or upper) then also it will not work. This is the main reason developer hegitate to work on magento and sometime they believe that the Magento is very complex. But if you will learn the internal archticture of the magento and you will have some template or sample module to start your work, you will really enjoy developing Magento module. In my custom magento module tutorial I will demonstrate how to create magento module and using a template module of the Magento(official name ModuleCreator) and also will demonstrate the complete structure so that creation of the Magento module will be easier for you.
Step -1 Create Module Using Magento ModuleCreator
Magento Module Creator is itself a Magento module which can create a skeleton or you can say blank Magento module for you. By creating the module using module creator your work will be minimized by 50%. After creation of the module using module creator, you only need to understand the flow of the Magento and little bit of the MVC framework to finish your job. You can download ModuleCreator from Magento Connect website(Thanks to Netz98). But the module supported for version 1.3 only and the current version of Magento is 1.7 on which ModuleCreator is not supported, very sad new. But no need to worry I have made some modification in the existing ModuleCreator and it is working absolutely fine. You can download the modified version of the moduleCreator by clicking here.
If you have installed the module using magento connect then you need to open the URL [yourmagentowebsite]/moduleCreator. If you have downloaded moduleCreator from my website unzip the file and place unzip folder in your magento website installation and open URL [yourmagentowebsite]/moduleCreator. In my case it is http://127.0.0.1/magento/moduleCreator . Once you will enter this URL you will find a login page. Following is the snapshot.
Please enter your Magento login username and password to enter into moduleCreator. Once you will enter the correct username and password you will get the interface where you need to enter information to create your own new custom module. Following is the screenshot of the page where you need to enter information to create your own custom module.
If you are new for Magento Let me explain that all the input required by moduleCreator for you.
Namespace: In magento module creation namespace is the container above the module. I will explain this in latter part of this tutorial. Type your company name here like techflirt.
Module: This is the name of your module.
Magento Root Directory: It is the root directory of the magento. It will be auto populated by the module. If not then please enter the correct path of your Magento installation root.
Leave Design field empty.
Click on Create button and you will see the location of your module and module related file. Below is the snapshot.Congratulation!!! You new module has been created. You can see the list of the location of the file created by modulecreator for you. You can login into your magento admin panel and see that a toolbar by your module has been created like below.
Let us move to step 2 where we will explore on how to create a new functionality in the magento module and the structure of magento module.
Step – 2 Customizing the your new Module(Adding New feature)
In step 1 you have created the blank module. Now it is time extend the feature of the magento using the blank skeleton. you can go to YourMagntoInstallation/app/code/local/techflirt/helloworld directory and see all basic required directory and files has been created. Also it has created a table in the sample database. If you have some basic knowlege of the magento module structure you can easily go on next step. If you have no idea about the magento module structure please read my next posting on Magento Module Structure.
Have a nice coding ahead.