Oneupweb : Magento Module Development Part 1: Creating the module

Posted on in Blog

Magento is a great eCommerce platform. It is extremely flexible. So flexible in fact that it is hard to know everything that is available to you as a developer. It’s even harder to know because the Magento community seems to keep its craft a secret… documentation is getting better, but it is sparse. Finding examples can be a chore. The best way to start developing extensions for Magento is to hop in and get your feet a little mucky.

In this first article, I am going to talk about what it takes to even get Magento to recognize your custom module.

What files and where?

The most important thing to remember is that the initialization magic happens in the “app” folder of your Magento installation.

Step 1: Create your configuration xml file for the module

Location: app/etc/modules
Let’s go ahead and create our module xml.


Please note the capitalization. It does matter. For example: codePool vs. codepool.
What does this all mean?

The name of our module. This also reflects the path to our module using this pattern:
/app/code/{codePool}/Oneupweb/ProductColorBox where {codePool} is the value supplied to the module xml, in this case local
Is this module active, true enough, it is
Where your module files will reside /app/code/{codePool}

Go ahead and save the file as Oneupweb_ProductColorBox.xml.

Login to the Magento admin and head over to the System tab and click on the Configuration item. From there go to the “Advanced” tab on the left, and click the “Advanced” tab that is inside of that one to verify our module installed correctly:

BOOM. Our module is installed and recognized by Magento. The first battle has been won, but the war is not over!

Step two setup your module directory

As mentioned the directory structure for your module files follows the convention (referencing the module xml file from above):
/app/code/{codePool}/Oneupweb/ProductColorBox *Notice the underscore from the name becomes the directory separator

So go ahead and create the following directories:

Within this folder we will be adding the typical directories (thought we may not use them all):
If your module does any kind of installation setup like creating tables then you will also have:

The following is a brief explanation of what these folders are for:

This is where the Blocks used in managing views for your module will be stored
This is the directory to store configuration xml files like config.xml or system.xml
Where you store, well…. helpers. Files that will help you manage data, additional functionality…whatever. Loaded with Mage::getHelper()
Where you store data models used in your module. Loaded with Mage::getModel() or Mage::getSingleton()
Controllers are what handle the requests for your module. They are essential the pages of your module
Contains installation scripts for your modules that need to create tables


This is the first step to getting your module going in Magento. If you want to download the module skeleton created in this chapter, you can grab it here Stay tuned for more in this series as we build our very own Magento module!

Up Next

Are you a forward-thinking financial leader with a passion for driving organizational growth through strategic financial management? Can you deliver wide-ranging insights and thorough analysis to influence business strategy? Do you enjoy quantifying financial impact to guide organizational decision making? Oneupweb is looking for a Director of Finance to join our leadership team andhead the...

Read More