For Example you have to overwrite Mage/Contacts/controller/IndexController.php
Step 1: First you have to make a xml in app/etc/modules/
with name CompanyName_NameSpace.xml
<?xml version="1.0"?>
<config>
<modules>
<CompanyName_NameSpace>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</CompanyName_NameSpace>
</modules>
</config>
Step2: You have to create the folders if not exist in
local/CompanyName/NameSpace/etc/
local/CompanyName/NameSpace/controllers/
In etc folder you have to create a config.xml file
<?xml version="1.0" encoding="utf-8"?>
<config>
<frontend>
<routers><!--Depending on the controllers area "frontend" or "admin" -->
<contacts><!-- base module to rewrite -->
<args>
<modules>
<CompanyName_NameSpace before="Mage_Contacts">Shweta_Newscontacts</CompanyName_NameSpace>
</modules>
</args>
</contacts>
</routers>
</frontend>
</config>
In controllers folder copy the Mage/Contacts/controller/IndexController.php file and include the lines:
include_once('Mage/Contacts/controllers/IndexController.php');
and
change the class name as:
class CompanyName_NameSpace_IndexController extends Mage_Core_Controller_Front_Action
Now apply changes in the file you wanted.
Now also, Magento take local pool file instead of core pool.
No comments:
Post a Comment