Developing module for Magento Tutorial - Where to Begin [Part 1]

Have you ever tried to read the complete list of features Magento comes with? Gosh, it's huge. And it's even more impressive when you look at Magento Connect and all the extensions available there. However, if you are reading this blog entry you are probably looking for something which is not available yet. Or maybe you are a developer who just loves to play with the code. Either way, for serious business reasons or just because of your hack-ish nature, developing a Magento module is fun.

Let's create something really really simple. The module. You might wonder what that nifty module will be doing. Well in this fist part it will does nothing but being declared in Magento!

Where to begin?

Take a loot at the directories structure of your Magento installation. In app > code > local, create a directory, which will be a kind of container for your modules, in Magento it's usually called code pool. If you wonder how to name it, I can say that company name you're working for is probably a good one. It is in my case ;)

So let's create it

$ cd app/code/local/
$ mkdir Baobaz

Then, in this container we should create the module. For the purpose of this blog let's call it "Reader" (in next few parts the reason of using this name should clarify, if not... well.. it's still sounds good ;) )

$ cd Baobaz
$ mkdir Reader

So far, so good. The next step is a little bit more complex, but still simple. Let's change current directory...

$ cd ../../../etc/modules/

Hm... where are we?

$ pwd /Your/favorite/place/for/web/projects/magento/app/etc/modules/

Now, you must tell Magento about the module. To do this you must create an xml file. Take your favorite editor and create a file called Baobaz_Reader.xml (as you probably guessed the name consists of <container_name>_<module_name>.xml

$ vi Baobaz_Reader.xml

Now put this into your file

<?xml version="1.0"?>
<config>
    <modules>
        <Baobaz_Reader>
            <active>true</active>
            <codePool>local</codePool>
        </Baobaz_Reader>
    </modules>
</config>

Save file. And.... Voilà! That's one small step for a man, one giant leap for man...gento. :-)

To be sure that Magento knows about our new module let's login to admin panel. Navigate to System > Configuration, choose Advanced, from Advances section (yes, it's on the left).

You should see Baobaz_Reader at the top (or somewhere there) of the "Disable modules output" list.

OK, OK, OK... I admit that our nifty module makes nothing so far but be patience, in a few next parts we will add some more useful features.

To be continued...

9 comments on "Developing module for Magento Tutorial - Where to Begin [Part 1]"

Cobay's picture
Cobay (visitor) - Wed, 31/03/2010 - 13:04:

Thanks for this posting...

David's picture
David (visitor) - Wed, 28/04/2010 - 15:33:

Really good...!
Really looking for part 2 now! ;-)

John's picture
John (visitor) - Tue, 15/06/2010 - 18:04:

Thanks,
This is very helpful and also your "Create your own controller" article is very helpful to us.
Thanks for sharing..

Ferry Ardhana's picture
Ferry Ardhana (visitor) - Thu, 21/10/2010 - 15:56:

Guys,

Thank you very much for share this post.. finally i can access my own module with follow your instruction...

Thanks you.

Jeroen's picture
Jeroen (visitor) - Sat, 02/04/2011 - 04:01:

Nice article! Is there any change of a sequel?

lifesgoodgirl's picture
lifesgoodgirl (visitor) - Thu, 17/11/2011 - 01:34:

Wow, perfect tutorial for beginners like me. Very simple and understandable. May i know the link for the part 2 tutorial? Please?

jayendra's picture
jayendra (visitor) - Mon, 28/11/2011 - 11:16:

hi,

Thanks to share this tutorial. This is very helpful.

Corporate Identity Design's picture
Corporate Identity Design (visitor) - Fri, 09/03/2012 - 14:41:

Really very good article. Keep updating more info like this.

Murty's picture
Murty (visitor) - Fri, 20/04/2012 - 15:19:

thank U for your post.
I created own module with the help of your instructions.