TO develop a module for magento first and fore most we have to under stand the directory structure of the magento so for this first just have an over view of the magento directory structure
1) first directory stucture to declare our module for this we have to add an xml file which declares our magento module. It recides in magentoroot/app/etc/modules/ your xml file should of name <company name>_<module name>.xml
2)after this you have to main code directory strture to define your module for this first go to the folder app/code now according to your module type (we have 3 types of modules core created and managed by magento it self community created and managed by community developers and 3 one is local 3rd party modules ) got into specified directory example go in local folder after this first create folder with your company as dexlared in xml file inside that folder you have to create a new folder with module name .
3)After this when your in your module folder now you have create direcories according to your need diifrent types of directories inside your module folder are
Block (to generate out to user end it interacts with the .phtml to provide out put to end users)
controller(it acts as controoler and interacts between model files and view file in magento defines url actions)
Model (all database functions and mapping is defined under this directory)
etc(it contains the definition of your module which includes config.xml ,system.xml etc)
sql(this icludes sql installer file which runs automatically after installation of module )
4) Beside this we can our js files to js folder css files to css folder.To add extra images and css files go to skin/frontend/<yourtheme>/<theme>/<create new folder>/ place extra files to this folder
5) now to call extra file use php function $this->getSkinUrl('path to extra file');
6) to define your module layout go to app/design/frontend/<yourtheme>/<theme>/layout/<layout xml file for module>
7) Similarly for defining new phtml files for your theme go to app/design/frontend/<yourtheme>/<theme>/template/ and defines you phtml files here.
1) first directory stucture to declare our module for this we have to add an xml file which declares our magento module. It recides in magentoroot/app/etc/modules/ your xml file should of name <company name>_<module name>.xml
2)after this you have to main code directory strture to define your module for this first go to the folder app/code now according to your module type (we have 3 types of modules core created and managed by magento it self community created and managed by community developers and 3 one is local 3rd party modules ) got into specified directory example go in local folder after this first create folder with your company as dexlared in xml file inside that folder you have to create a new folder with module name .
3)After this when your in your module folder now you have create direcories according to your need diifrent types of directories inside your module folder are
Block (to generate out to user end it interacts with the .phtml to provide out put to end users)
controller(it acts as controoler and interacts between model files and view file in magento defines url actions)
Model (all database functions and mapping is defined under this directory)
etc(it contains the definition of your module which includes config.xml ,system.xml etc)
sql(this icludes sql installer file which runs automatically after installation of module )
4) Beside this we can our js files to js folder css files to css folder.To add extra images and css files go to skin/frontend/<yourtheme>/<theme>/<create new folder>/ place extra files to this folder
5) now to call extra file use php function $this->getSkinUrl('path to extra file');
6) to define your module layout go to app/design/frontend/<yourtheme>/<theme>/layout/<layout xml file for module>
7) Similarly for defining new phtml files for your theme go to app/design/frontend/<yourtheme>/<theme>/template/ and defines you phtml files here.
No comments:
Post a Comment