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"?>
<config>
  <global>
    <models>
      <stockupdate>
        <class>Swn_StockUpdate_Model</class>
      </stockupdate>
    </models>
  </global>
</config>

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"?>
<config>
  <modules>
    <Swn_StockUpdate>
      <active>false</active>
      <codePool>local</codePool>
    </Swn_StockUpdate>		
  </modules>
</config>

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

One thought on “Creating your own Magento module

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>