A simple Basic Module in Magento – The Structures – Part 2

First we need to create few new files & folders. Now go to app/code/local directory to create new directories. Here we’ll go continue Magento Module tutorial part 2.

However, our hosting provides both SSD cloud hosting & servers. Both pro & plus hosting plans include premium services such as Aspiration CDN, Web development & transfer support. Our basic hosting begins for just $9.99 per month. Next enjoy our dedicated cloud 4GB server for only $99.99 per month only. Also enjoy different Aspiration rewards on regular basis. Here see our special plans & contact us for further information & support.

Tanzia Farin Chy – Aspiration Hosting

Magento Module Tutorial – NameSpace & NameModule

Now, we will make directory for “namespace”. The DIR may include Authors, developers, company or anything relevant etc. Here we’ll use the default namespace for Magento which is “Mage”. Next create a DIR under the following path app/code/local/Mage.

After creating the namespace we’ll create a new DIR “name of the module”. The module will create a new log each time a new product has been saved by merchant. So, we’ll name it ProductLogUpdate. Now create DIR under the following path app/code/local/Mage/ProductLogUpdate.

Here is the structure of the module in following screenshot:

magento module tutorial

***Note: the name of the DIRs are case sensitive. ***

Magento Module Tutorial – Configuration

However we’ll edit the newly created module as we need it. Let’s find out the configuration files under new module DIR. For example: ProductlogUpdate is under etc directory. As a result, we’ll create a new XML file to configure our module. Now create config.xml under following path:

app/code/local/Mage/ProductLogUpdate/etc/config.xml

Further the XML file will notify Mage the location of our module. As well as, the contents inside our module. Also other stuffs of new module such versions, events, models etc. Hence the file consist of the beneath codes at initial stage:


<?xml version="1.0"?>

<config>

<modules>

<Mage_ProductLogUpdate>

<version>0.0.1</version>

</Mage_ProductLogUpdate>

</modules>

</config>

Config – Root of Magento module config.

Modules – contains Mage module’s basic information.

Mage_ProductLogUpdate – Must be same as the namespace.

NameSpace_ModuleName – Must be same as the module name.

Version – The current version of the module.

 

Currently Viewing Part 2 | Go back to Part 1|Go to Part 3|Go to Part 4