Skip to content

Commit

Permalink
feat: Creating a Module
Browse files Browse the repository at this point in the history
  • Loading branch information
HDTran committed Apr 8, 2019
1 parent 5ed0e9b commit 1503a03
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/code/local/MasteringMagento/Example/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

class MasteringMagento_Example_Helper_Data extends Mage_Core_Helper_Abstract {

}

?>
32 changes: 32 additions & 0 deletions app/code/local/MasteringMagento/Example/etc/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!DOCTYPE config>
<!--
/**
MasteringMagento = namespace
Example = module name
*/
-->
<config>
<modules>
<MasteringMagento_Example>
<version>0.0.0</version>
</MasteringMagento_Example>
</modules>
<global>
<models>
<example>
<class>MasteringMagento_Example_Model</class>
</example>
</models>
<blocks>
<example>
<class>MasteringMagento_Example_Block</class>
</example>
</blocks>
<helpers>
<example>
<class>MasteringMagento_Example_Helper</class>
</example>
</helpers>
</global>
</config>
16 changes: 16 additions & 0 deletions app/etc/modules/MasteringMagento_Example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<!DOCTYPE config>
<!--
active = whether it's active
codePool = what folder to look in under app/code
depends = dependencies from Magento
-->
<config>
<modules>
<MasteringMagento_Example>
<active>true</active>
<codePool>local</codePool>
<depends />
</MasteringMagento_Example>
</modules>
</config>

1 comment on commit 1503a03

@HDTran
Copy link
Owner Author

@HDTran HDTran commented on 1503a03 Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.6. Recap: Creating a Module

Folder Structure

The folder structure is app/code/local/<NameSpace>/<Module>. It consists of Block, etc, Model, controllers, and Helper.

Configuration

The configuration files necessary to load the module into Magento are app/code/local/<NameSpace>/<Module>/etc/config.xml and app/etc/modules/<NameSpace>_<Module>.xml.

Please sign in to comment.