For example you want to override OnepageController.php file and overwride indexAction.
In this example my custom module name space is “MyBlog” and i am going to overwride indexAction Mage_Checkout_OnepageController
Base File Path : app/code/core/Mage/Checkout/controllers/OnepageController.php
To Do the same we have to follow bellow steps.
Step1: We need to create a custom module
File Path : app/etc/modules/
File Name: MyBlog_Checkout.xml
File Content:
<?xml version=”1.0″?>
<config>
<modules>
<MyBlog_Checkout>
<active>true</active>
<codePool>local</codePool>
</MyBlog_Checkout>
</modules>
</config>
Step2: Now we have to create bellow files in our custom module
File Path: app/code/local/MyBlog/Checkout/etc/config.xml
Bellow is content for config.xml file
<?xml version=”1.0″?>
<config>
<modules>
<MyBlog_Checkout>
<version>0.0.1</version>
</MyBlog_Checkout>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<MyBlog_Checkout before=”Mage_Checkout”>MyBlog_Checkout</MyBlog_Checkout>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
Bellow is content for OnepageController.php
File Path : app/code/local/MyBlog/Checkout/controllers/OnepageController.php
<?php
require_once ‘Mage/Checkout/controllers/OnepageController.php’;
class MyBlog_Checkout_OnepageController extends Mage_Checkout_OnepageController {
public function indexAction()
{
echo “Great! You are in MyBlog checkout controller section”;
exit;
}
}
?>