1

I'm trying to override the loginactions, but i'm not to get this working. Removed all the cache and stuff, but its looking i'm missing a step. Mine files are like the following:

app/code/etc/Something_Customlogin.xml

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

app/code/local/Something/Customlogin/etc/config.xml

    <?xml version="1.0"?>
    <config>
        <modules>
            <Something_Customlogin>
                <version>1.0.1</version>
            </Something_Customlogin>
        </modules>
        <frontend>
            <routers>
                <customer>
                    <args>
                        <modules>
                            <Something_Customlogin before="Mage_Customer">Something_Customlogin
                            </Something_Customlogin>
                        </modules>
                    </args>
                </customer>
            </routers>
        </frontend>
    </config>

app/code/local/Something/Customlogin/controllers/AccountController.php

<?php
//Controllers are not autoloaded so we will have to do it manually:
require_once Mage::getModuleDir('controllers', 'Mage_Customer').DS.'AccountController.php';
class Something_Customlogin_AccountController extends Mage_Customer_AccountController {
    //Overloaded loginPostAction
    public function loginPostAction() {
        //Just to make sure
        echo "YES YES YES WE surely CAN!!";
        die; 
    }


    /**
     * Customer login form page
     */
    public function loginAction() {
        echo "YES YES YES WE CAN!!";
        die;
    }
}

BUT I'm not getting the printed text on the login page?! I have the feeling that im missing something.

Any help appreciated!

1
  • There's no such Magento folder as app/code/etc Jun 16, 2014 at 2:46

3 Answers 3

2

It looks like your problem is this

 app/code/etc/Something_Customlogin.xml

The Something_Customlogin.xml file is a module declaration file. It's the file that tells Magento your module exists. You've placed it in the wrong folder. It belongs in

app/etc/modules

If you fix that, and remove the newline in config.xml from

<Something_Customlogin before="Mage_Customer">Something_Customlogin
</Something_Customlogin>

so it reads

<Something_Customlogin before="Mage_Customer">Something_Customlogin</Something_Customlogin>

you should be good to go.

1

The problem, if your code is a direct copy into your question, is the new line when setting up your router. If you update your config.xml to remove the line as follows then your controller should be called.

<Something_Customlogin before="Mage_Customer">Something_Customlogin</Something_Customlogin>
1
  • Thanks, for your answer, but this is not the case badly enough. Any other idea?
    – reinaud
    May 19, 2014 at 8:24
0

config.xml on add

<global>

          <models>
           <customer>
                <rewrite>
                    <customer>Something_Customlogin_Model_Customer</customer>
                </rewrite>
            </customer>
          </models>
    </global>

see my config.xml

your module path/controllers/AccountController.php

on

<?php 

require_once 'Mage/Customer/controllers/AccountController.php';
class Something_Customlogin_AccountController extends Mage_Customer_AccountController
{
public function loginPostAction(){
     // your function

}

?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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