4

I am trying to override local codepool extension controller with the other local extension, but its not working, don't know the reason, firstextension is the extension I want to override by secondextension

here is my code

config.xml

<admin>
    <routers>
        <firstextension>
            <args>
                <modules>
                    <Namespace_secondextension before="Namespace_Firstextension">Namespace_secondextension_Adminhtml</Namespace_secondextension>
                </modules>
            </args>
        </firstextension>

    </routers>
</admin>

and controller

<?php

  require_once 'local/Namespace/Firstextension/controllers/Adminhtml/CustomController.php';
  class Namespace_Secondextension_Adminhtml_CustomController extends Namespace_Firstextension_Adminhtml_CustomController
  {
      public function saveAction()
      { 
      }
  }
2
 require_once 'local/Namespace/Firstextension/controllers/Adminhtml/CustomController.php';

to

 require_once 'Namespace/Firstextension/controllers/Adminhtml/CustomController.php';

proper way :

require_once Mage::getModuleDir('controllers','Namespace_Firstextension').DS.Adminhtml.DS.'CustomController.php';

Also,need to change in

<Namespace_secondextension before="Namespace_Firstextension">Namespace_secondextension_Adminhtml</Namespace_secondextension>

you need to change from Namespace_secondextension_Adminhtml to Namespace_Secondextension

  • 1
    Already tried this – Ahmed Jan 5 '15 at 9:57
  • 1
    still not working – Ahmed Jan 5 '15 at 10:02
  • 1
    And require_once Mage::getModuleDir('controllers','Namespace_Firstextension').DS.Adminhtml.DS.'CustomController.php'; to require_once Mage::getModuleDir('controllers','Namespace_Firstextension').DS.'Adminhtml'.DS.'CustomController.php'; :) – Ahmed Jan 5 '15 at 10:34

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.