3

I'm trying to externd a controller. The customer controller to be exact. I found a example on Inchoo But I can't get it to work.

I tried turning off all othermodules. I've checked everything multipletimes. Nothing seems to work. We run Magento 1.9.0.1

app/code/local/MyModule/Custompasswordforget/controllers/AccountController.php

<?php
require_once(Mage::getModuleDir('controllers','Mage_Customer').DS.'AccountController.php')
//die('hit this file');  // doesn't work
class MyModule_Custompasswordforget_AccountController extends Mage_Customer_AccountController {
  public function forgotPasswordAction()
  {
    //die('hit this method');  // doesn't work

    parent::forgotPasswordAction();
  }
}

app/code/local/MyModule/Custompasswordforget/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <MyModule_Custompasswordforget>
      <version>0.9.0</version>
    </MyModule_Custompasswordforget>
  </modules>
  <frontend>
    <routers>
      <customer>
        <args>
          <modules>
            <MyModule_Custompasswordforget before="Mage_Customer_AccountController">
              MyModule_Custompasswordforget
            </MyModule_Custompasswordforget>
          </modules>
        </args>
      </customer>
    </routers>
  </frontend>
</config>

app/etc/modules/MyModule_Custompasswordforget.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <modules>
    <MyModule_Custompasswordforget>
      <version>0.9.0</version>
      <active>true</active>
      <codePool>local</codePool>
    </MyModule_Custompasswordforget>
  </modules>
</config>

I'm afraid for a small oversight but I just can't find it.
Thanks in advance.

  • 1
    If that really is your xml then try it with the <MyModule_Custompasswordforget before="Mage_Customer_AccountController">MyModule_Custompasswordforget</MyModule_Custompasswordforget> on a single line as newlines can mess the xml up – David Manners Sep 23 '14 at 14:06
  • 1
    Nice words David :-) Linebreaks in Magento config.xml files in text-entities are ALWAYS a problem :-) – Fabian Blechschmidt Sep 23 '14 at 14:09
  • this line space issue so irritate me.... :) – Amit Bera Sep 23 '14 at 17:32
  • That can really be the problem? :S I'll ty it tomorrow. – janw Sep 23 '14 at 22:41
  • I hate Magento. Is it really that hard to trim() something. – janw Sep 24 '14 at 9:56
4

Make your routers section from config.xml look like this:

<routers>
  <customer>
    <args>
      <modules>
        <MyModule_Custompasswordforget before="Mage_Customer">MyModule_Custompasswordforget</MyModule_Custompasswordforget>
      </modules>
    </args>
  </customer>
</routers>

remove the spaces inside the tags because magento does not trim the values.
Your module router should be loaded before the Magento_Customer module not Magento_Customer_AccountController.

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.