Creating your own Magento module

Feb 6, 2011

Create a folder here /app/code/local/[organization_name]/[module_name]

You need an etc folder with config.xml in it containing something like the below. In this case it is expecting at least a Model folder with a php file (with any name) that defines a class with a matching name plus the name of the file it is in.

<?xml version="1.0"?>

This would match a class in a file Model/Updater.php with the following class.

class Swn_StockUpdate_Model_Updater {

don’t forget to switch the module on by adding it to an XML file under /shop/app/etc/ I don’t think it matters what the file is actually called (if it can detect these files, why can’t it detect the modules? they were clearly not thinking of DRY when they designed this bit). The file needs to contain something like the following, with the local, SWN_ and _StockUpdate referring to the folders the module is in (and/or the actual class names? who knows.).

<?xml version="1.0"?>

For more info try This Article, and this is a useful [PHP tool][3].