1. Create your own Magento module XML can file
( app/etc/modules/Pw_Manageproducts.xml)<?xml version=”1.0″?>
<config>
<modules>
<Pw_Manageproducts>
<active>true</active>
<codePool>local</codePool>
</Pw_Manageproducts>
</modules>
</config>
2.Make a directory structure for the Magento module
–controllers/
–sql/
–Block/
–etc/
–Helper/
3.Make a block class
<?php
class Pw_Manageproducts_Block_Manageproducts extends Mage_Core_Block_Template
{
}
?>
4.Prepare the front controller
<?php
class Pw_Manageproducts_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
(app\code\local\Pw\Manageproducts\controllers\IndexController.php)
5.Define your config.xml file
In order to do this, just follow this:
<?xml version=”1.0” encoding=”UTF-8“?>
<config>
<modules>
<Pw_Manageproducts>
<version>1.0.1</version>
</Pw_Manageproducts>
</modules>
<global>
<models/>
<blocks>
<manageproducts>
<class>Pw_Manageproducts_Block</class>
</manageproducts>
</blocks>
</global>
<frontend>
<routers>
<manageproducts>
<use>standard</use>
<args>
<module>Pw_Manageproducts</module>
<frontName>manageproducts</frontName>
</args>
</manageproducts>
</routers>
<layout>
<updates>
<manageproducts>
<file>pw/manageproducts.xml</file>
</manageproducts>
</updates>
</layout>
</frontend>
<default>
<manageproducts>
<product>
</product>
</manageproducts>
</default>
</config>
6.Make a template file
The template file will be used to render HTML. Remember to use only lower case for folder and file names.
(app\design\frontend\default\default\template\pw\manageproducts\manageproducts.phtml)
<?php
echo “<h1>We are going to manage our magento products…</h1>”;
?>
7.Make the layout.xml file
(app\design\frontend\default\default\layout\pw\manageproducts.xml)
<?xml version=”1.0“?>
<layout version=”0.1.0″>
<manageproducts_index_index>
<reference name=”root”>
<action method=”setTemplate”><template>page/1column.phtml</template></action>
</reference>
<reference name=”content”>
<block type=”manageproducts/manageproducts” name=”manageproducts” template=”pw/manageproducts/manageproducts.phtml”/>
</reference>
</manageproducts_index_index>
</layout>
1.Use it in a PHP file.
<?php
echo $this->getLayout()->createBlock(‘manageproducts/manageproducts‘)
->setBlockId(‘manageproducts‘)->toHtml() ; ?>