Welcome to 3DMICK
+91 (971) 119-1127

Create Custom Module in Magento

Create Custom Module in Magento

Magento is best eCommerce system that offer rich customization possibilities by extensions and modules. Magento is built on a fully modular model that influences an unlimited scalability and flexibility. These allow you to add functionality anywhere, whether in a “static” block manner that’s more than static, or a shipping/payment module, or large module to do something as large as integrating a 3rd party system (or multiple systems).
There are many things custom Modules can do, from editing your Database, to handling module upgrades to overriding classes (Blocks, Controllers, and Models) and more! So you can write new modules for Magento by yourself. Here I want to show you how to create simple costume module Magento.

In Magento all modules are organized under a package. This package is nothing but a simple folder under codepool containing different modules. For example all core modules of magento system is kept under package “Mage” (open the folder /app/code/core/ , you see the folder “Mage” under which all system module resides).

Sample file structure:

Step 1: Create an xml file for modules declaration app/etc/modules/test.xml
< ?xml version="1.0"?>



Step 2: Module Configuration
Create a controller classapp/code/local/Just/Webdevelopment/controllers/IndexController.php
< ?php class test_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { $this--->loadLayout();

Create a Block class app/code/local/Just/testing/Block/testing.php
< ?php class test_Block_testing extends Mage_Core_Block_Template { // necessary methods }?>

Create a Helper class app/code/local/Just/testing/Helper/Data.php
< ?php class test_Helper_Data extends Mage_Core_Helper_Abstract { } ?>

Create configuration xml in app/code/local/Just/testing/etc/config.xml
< ?xml version=”1.0″?>




Step 3: Define Frontend Template
Define page layout in app/design/frontend/default/default/layout/testing.xml
< ?xml version=”1.0″?>

Create template fileapp/design/frontend/default/default/template/testing/testing.phtml
< ?php echo "Your Custom module is ready to use…!!!!"; ?>