http://www.magentocommerce.com/magento-connect/MagePsycho/extension/3763/custom_login_redirect

Or

You Have to create a small Extension for this Requirement.

Create the extension as follows.

app/etc/modules/Sushant_Loginredirect.xml


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

app/code/local/Sushant/Loginredirect/etc/adminhtml.xml


<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <loginredirect translate="title">
                                        <title>Login Redirect</title>
                                    </loginredirect>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

app/code/local/Sushant/Loginredirect/etc/config.xml


<?xml version="1.0"?>
<config>
    <modules>
        <Sushant_Loginredirect>
            <version>1.0.0</version>
        </Sushant_Loginredirect>
    </modules>
    <global>
        <helpers>
            <loginredirect>
                <class>Sushant_Loginredirect_Helper</class>
            </loginredirect>
        </helpers>
        <models>
            <loginredirect>
                <class>Sushant_Loginredirect_Model</class>
            </loginredirect>
        </models>
    </global>
    <frontend>
        <routers>
            <loginredirect>
                <use>standard</use>
                <args>
                    <module>Sushant_Loginredirect</module>
                    <frontName>loginredirect</frontName>
                </args>
            </loginredirect>
        </routers>
        <events>
            <customer_login>
                <observers>
                    <loginredirect>
                        <class>loginredirect/observer_customer</class>
                        <method>customerLogin</method>
                    </loginredirect>
                </observers>
            </customer_login>
        </events>
    </frontend>
</config>

app/code/local/Sushant/Loginredirect/etc/system.xml


<?xml version="1.0"?>
<config>
    <sections>
        <loginredirect translate="label">
            <label>Login Redirect</label>
            <tab>customer</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1001</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <settings translate="label">
                    <label>Setting</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>100</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label comment">
                            <label>Enabled</label>
                            <!-- <comment><!&#91;CDATA&#91;&#93;&#93;></comment> -->
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enabled>
                        <group translate="label comment">
                            <label>Customer Group</label>
                            <!-- <comment><!&#91;CDATA&#91;&#93;&#93;></comment> -->
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_customer_group</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends>
                                <enabled>1</enabled>
                            </depends>
                        </group>
                        <path_redirect>
                            <label>Path Redirect</label>
                            <!-- <comment><!&#91;CDATA&#91;&#93;&#93;></comment> -->
                            <frontend_type>text</frontend_type>
                            <validate>validate-text</validate>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends>
                                <enabled>1</enabled>
                            </depends>
                        </path_redirect>
                    </fields>
                </settings>
            </groups>
        </loginredirect>
    </sections>
</config>

app/code/local/Sushant/Loginredirect/Helper/Data.php


<?php
class Sushant_Loginredirect_Helper_Data extends Mage_Core_Helper_Abstract
{
    const XML_CONFIG_PATH = 'loginredirect/settings/';

    public function getConfigValue($key, $store = '')
    {
        return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key, $store);
    }

    /**
     * Return path for redirect
     *
     * @return string
     */
    public function getRedirectUrl()
    {
        $_path = (string) $this->_getConfigValue('path_redirect');
        return Mage::getUrl($_path);
    }

    public function isEnabled()
    {
        return (bool) $this->_getConfigValue('enabled');
    }

    protected function _getConfigValue($key)
    {
        return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key);
    }
}
?>

app/code/local/Sushant/Loginredirect/Model/Observer/Customer.php


<?php
class Sushant_Loginredirect_Model_Observer_Customer
{
    public function customerLogin(Varien_Event_Observer $observer)
    {
        if (Mage::helper('loginredirect')->isEnabled()) {
            $_session = $this->_getSession();

            /* Check the user's group and do the redirection.*/
            if($this->_checkActionForCustomerGroup()) {
                $_session->setBeforeAuthUrl(Mage::helper('loginredirect')->getRedirectUrl());
            }
        }
    }

    protected function _checkActionForCustomerGroup()
    {
        /* @var $customer Mage_Customer_Model_Customer */
        $customer = $this->_getSession()->getCustomer();

        if($customer) {
            if($customer->getGroupId() == Mage::helper('loginredirect')->getConfigValue('group')) {
                return TRUE;
            }
        }

        return FALSE;
    }

    /**
     * @return Mage_Core_Model_Abstract
     */
    protected function _getSession()
    {
        return Mage::getSingleton('customer/session');
    }
}
?>


1 Comment

Magento Guru (Raj) (@magepsycho) · March 18, 2016 at 2:25 pm

Thanks for explaining the custom redirect after login.
If you guys are looking for custom redirection after registration, logout, newsletter subscription (as per customer group), I would suggest to check the following extension:

http://www.magepsycho.com/custom-login-redirect-pro.html

“Custom Redirect Pro allows customer group wise redirection to custom page after register, login & logout actions with many extra features.”

Leave a Reply to Magento Guru (Raj) (@magepsycho) Cancel reply

Avatar placeholder

Your email address will not be published. Required fields are marked *