Step2. Binding all the folder
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document : config.xml
Created on : Jan 7th, 2012, 3:19 PM
Author : V.V.N.Pradeep
Description:
Purpose of the document follows.
This configuration is used to bind the all folder
inside the Pradeep module.
How to rewrite a controller
Note: Don't forget to change the frontname to customer
-->
<config>
<frontend>
<routers>
<pradeep>
<use>standard</use>
<args>
<module>Veera_Pradeep</module>
<!-- Don't forget to change the frontname to customer -->
<!-- <frontName>pradeep</frontName> -->
<frontName>customer</frontName>
</args>
</pradeep>
</routers>
<layout>
<updates>
<pradeep>
<file>pradeep.xml</file>
</pradeep>
</updates>
</layout>
<!-- End of layout tag -->
</frontend>
<global>
<!-- This section is to bind the block with our module Pradeep -->
<blocks>
<pradeep>
<class>Veera_Pradeep_Block</class>
</pradeep>
</blocks>
<!-- rewriting a controller -->
<routers>
<rewrite>
<pradeep>
<from><![CDATA[#^/customer/account/create/#]]></from>
<to>/pradeep/account/create/</to>
</pradeep>
</rewrite>
<!-- If you want to rewrite all controller's action,
then below is the answer -->
<!-- <rewrite>
<pradeep>
<from><![CDATA[#^/customer/account/#]]></from>
<to>/pradeep/account/</to>
</pradeep>
</rewrite>
-->
<!-- multiple rewrite under same front end name-->
<rewrite>
<pradeep>
<from><![CDATA[#^/customer/address/#]]></from>
<to>/pradeep/address/</to>
</pradeep>
</rewrite>
</routers>
<!-- end of rewritting -->
<!-- End of block-->
</global>
</config>
/******************************/
Step3: Writng Controller
<?php
/*
* @author : V.V.N.Pradeep
* @description --
* Purpose of the document follows.
* In this tutorial I am going to rewrite the
* http://demo.com/magento/customer/account/create action.
* It is not necessary to mention the sane Controller name or action name.
* You can give any name, but best practice is to keep the same name,
* DS => Directory Separator
*
*/
?>
<?php
require_once Mage::getModuleDir('controllers', 'Mage_Customer').DS.'AccountController.php';
class Veera_Pradeep_AccountController extends Mage_Customer_AccountController
{
public function createAction()
{
echo "overriding customer controller's create action";
}
}
?>
/******************************/
Output:
To see the output type the url into your browser
example:
http://demo.com/magento/customer/account/create/ [before rewriting check the output]After rewriting Check the output
Enjoy............... :)
No comments:
Post a Comment