Magento: Best Way to Learn the Best Way to Build a Module

Magento Icon

One of the most valuable tools that I have found in Magento module development is to actually just look at Magento’s code. It seems obvious, but at least for me (for a while), it wasn’t. Every directory that you see inside of app/code/core/Mage/ is just a Magento module built in the same format that you would build your own in app/code/local/yourstuff/.

I look at core code constantly. If I need to figure out how to do a certain type of configuration option in my module, I just look at the etc/system.xml files. If I need to add a new order attribute, I check out Sales/Model/Mysql4/Setup.php and emulate the file structure and method needed in that file to setup my own custom order attribute (making sure to properly configure config.xml as well). The list goes on and on.

Just by having an installation and access to all the core files, you really have most of the examples that you would need to help you in writing your own module. Just follow what they do, their same folder structures and everything, and you’ll be well on your way to writing a better quality module.

This entry was posted in Magento. Bookmark the permalink.

2 Responses to Magento: Best Way to Learn the Best Way to Build a Module

  1. Josh, I agree with the user above regarding the point that he/she is trying to make.

    Its really much easier to understand if you know magento architecture. I think this url would help a lot of initial learners

  2. ITA003 says:

    True… but sometimes is difficult to looking for the appropriate module starting from URL…

    IMHO the best way is to know the magento’s architecture, and I learned it quickly with Two book…