Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Override/Rewrite Magento core blocks and controllers to Local directory


First you will need to make a xml file for your new module at app/etc/modules directory
CompanyName_Adminhtml.xml


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


Then, make folders in your app/code/local directory as follows:
app/code/local/CompanyName/Adminhtml/controllers/CustomerController.php
app/code/local/CompanyName/etc/config.xml


In etc/config.xml, your code should look like below:
<?xml version="1.0"?>
<config>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <CompanyName_Adminhtml before="Mage_Adminhtml">CompanyName_Adminhtml</CompanyName_Adminhtml>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>


In controllers/CustomerController.php, your code should look like below:
<?php
include_once("Mage/Adminhtml/controllers/CustomerController.php");
class CompanyName_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController
{
    public function saveAction()
    {
        //Your change goes here..
    }
}
?>

Please support us, Like us on Facebook.

  1. I relish, lead to I discovered exactly what I was looking for.
    You have ended my 4 day lengthy hunt! God Bless you man. Have a nice day.
    Bye

    my web-site - heart rate

    ReplyDelete

 

Copyright @ 2017 HKBlog.