5

I have been trying to override magento(1.9) admin's customer controller with my controller. But even though I have followed the steps correctly, I couldn't override the customer controller. Following are my codes

config.xml

<?xml version="1.0" ?>
<config>
<modules>
    <Aemulare_Customer>
        <version>1.0</version>
    </Aemulare_Customer>
</modules>

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Aemulare_Customer before="Mage_Adminhtml">
                        Aemulare_Customer_Adminhtml
                    </Aemulare_Customer>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
</config>

My Controller(app/code/local/Aemulare/Customer/controllers/Adminhtml/CustomerController.php)

    <?php

     require_once "Mage/Adminhtml/controllers/CustomerController.php";

     class Aemulare_Customer_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController {

      public function indexAction() {
         die("H");
      }
}

What might be the issue? Please help.

7

i think there is space issue remove the space..

<Aemulare_Customer before="Mage_Adminhtml">Aemulare_Customer_Adminhtml</Aemulare_Customer>
  • 1
    OMG! Thank you so much. I never thought that would be a issue! – Saravanan Sampathkumar Dec 21 '15 at 4:33
2

Space is creating issue as magento compare text string between these tag. It should be like below.

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Aemulare_Customer before="Mage_Adminhtml">Aemulare_Customer_Adminhtml</Aemulare_Customer>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
0

Try this

config.xml

<?xml version="1.0" ?>
<config>
<modules>
    <Aemulare_Customer>
        <version>1.0</version>
    </Aemulare_Customer>
</modules>
   <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Aemulare_Customer before="Mage_Adminhtml">Aemulare_Customer_Adminhtml</Aemulare_Customer>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

Controller file :

app/code/local/Aemulare/Customer/controllers/Adminhtml/CustomerController.php

and define the class:

<?php

require_once 'Mage/Adminhtml/controllers/Customer/CustomerController.php';
class Aemulare_Customer_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController
{
    public function indexAction()
    {
        die('a'); //just for testing
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.