This example to show you override edit action from ProductController.php is located app/code/core/Mage/Adminhtml/controllers/Catalog

Step 1: Create new module from app/etc/JPK_New.xml

<?xml version="1.0"?>
<config>
<modules>
<JPK_New>
<active>true</active>
<codePool>local</codePool>
</JPK_new>
</modules>
</config>

Step 2: Make config.xml from app/code/local/JPK/New/etc/config.xml

<?xml version="1.0"?>
<config>

<modules>
<JPK_New>
<version>0.0.1</version>
</JPK_New>
</modules>

<admin>
<routers>
<adminhtml>
<args>
<modules>
<JPK_New before="Mage_Adminhtml">JPK_New</JPK_New>
</modules>
</args>
</adminhtml>
</routers>
</admin>

</config>

Using above code you want to override any action from any adminhtml controller. Only you need to make controller file for that.

Step 3: Make controller file from app/code/local/JPK/New/controllers/Catalog/ProductController.php

And first include your default controller class file then write new controller class for update then extends your new controller file to your default controller class like here extends with “Mage_Adminhtml_Catalog_ProductController”.

<?php
include_once("Mage/Adminhtml/controllers/Catalog/ProductController.php");
class JPK_New_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
{
public function saveAction(){
echo "Testing";exit;
}
}
?>

Notice : Check the name of routers path is same for which module you are going to override. here it is adminhtml (After  <admin><routers> )
But instead of adminhtml some custom downloaded modules seems to be using other names like admin_catalog or admin_blog etc..
So ensure that name need to gave after <admin><routers><—custom name same origianl config.xml—->

 Leave a Reply

(required)

(required)


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
© 2014 Developers Corner Suffusion theme by Sayontan Sinha