Creating custom Magento module is a little bit tricky and tough, especially if you are going with the 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 hesitate to work on Magento and sometimes they believe that the Magento is very complex. But if you will learn the internal architecture 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 be 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 a 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 the 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 to 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 the 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!!! Your 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’s 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 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 knowledge 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.