0

I have followed few instructions found in this forum, but I must be missing something. I am trying to override Customer controller, specifically _welcomeCustomer method. Here is what I have got:

Magento version: 1.9.4.5;
Namespace: WebKutir;
Module: Module_Authenticator;

/app/code/local/WebKutir/Module/Authenticator/etc/config.xml:

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

/app/etc/modules/WebKutir_Module_Authenticator.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <WebKutir_Module_Authenticator>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Customer />
            </depends>
        </WebKutir_Module_Authenticator>
    </modules>
</config> 

/app/code/local/WebKutir/Module/Authenticator/controllers/AccountController.php:

<?php
require_once Mage::getModuleDir('controllers', 'Mage_Customer') . DS . 'AccountController.php';
class WebKutir_Module_Authenticator_controllers_AccountController extends Mage_Customer_AccountController
{
    /**
     * Add welcome message and send new account email.
     * Returns success URL
     *
     * @param Mage_Customer_Model_Customer $customer
     * @param bool $isJustConfirmed
     * @return string
     */
    protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
    {
        $this->_getSession()->addSuccess(
            $this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())
        );

        $successUrl = $this->_getUrl('*/*/index', array('_secure' => true));
        if ($this->_getSession()->getBeforeAuthUrl()) {
            $successUrl = $this->_getSession()->getBeforeAuthUrl(true);
        }
        return $successUrl;
    }
}

I have flushed cache, custom module is visible via magento admin panel, but still the system is using Mage core files for Customer. Any help would be greatly appreciated.

2 Answers 2

1

Can you try by removing Module from everywhere? E.g.

app/code/local/WebKutir/Authenticator/etc/config.xml:

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

app/etc/modules/WebKutir_Authenticator.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <WebKutir_Authenticator>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Customer />
            </depends>
        </WebKutir_Authenticator>
    </modules>
</config>

app/code/local/WebKutir/Authenticator/controllers/AccountController.php:

<?php
require_once Mage::getModuleDir('controllers', 'Mage_Customer') . DS . 'AccountController.php';
class WebKutir_Authenticator_AccountController extends Mage_Customer_AccountController
{
    /**
     * Add welcome message and send new account email.
     * Returns success URL
     *
     * @param Mage_Customer_Model_Customer $customer
     * @param bool $isJustConfirmed
     * @return string
     */
    protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
    {
        $this->_getSession()->addSuccess(
            $this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())
        );

        $successUrl = $this->_getUrl('*/*/index', array('_secure' => true));
        if ($this->_getSession()->getBeforeAuthUrl()) {
            $successUrl = $this->_getSession()->getBeforeAuthUrl(true);
        }
        return $successUrl;
    }
}

This is because Magento module structure works with following path:

app/code/{CodePool}/{Package}/{Module}

and you have added one more layer on this path.

Let me know if it helped.

0
1

The issue seems to be with the class name in your controller file.

Change this line:

class WebKutir_Module_Authenticator_controllers_AccountController extends Mage_Customer_AccountController

To:

class WebKutir_Module_Authenticator_AccountController extends Mage_Customer_AccountController
1
  • Implemented your suggestion but it still not working...
    – Tareq
    Commented May 22 at 6:07

Your Answer

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

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