Notice: Undefined index: current_observation in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 34

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: local_tz_offset in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: local_tz_offset in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: icon in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 70

Notice: Undefined index: weather in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 76

Notice: Undefined index: temp_c in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 106
Magento 1 redirect to home page after login Magento 1 redirect to home page after login – Proodos


Notice: Undefined index: current_observation in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 34

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: local_tz_offset in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 53

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: display_location in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: local_tz_offset in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 54

Notice: Undefined index: icon in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 70

Notice: Undefined index: weather in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 76

Notice: Undefined index: temp_c in /home/itanvemu/prood-os.com/wp-content/plugins/pdsweather/pdsWeather.php on line 106
clear
°C
Proodos

Magento 1 redirect to home page after login

by Iva Korlevic
November 21, 2016

Hi,
I had to do a simple redirect to home page after customer is logged in, instead of him going to customer account page. The way you do it is using an observer. Magento 1 has an event that fires after login is completed, and this is the event that we’d need. First change the customer settings in system configuration, set Redirect Customer to Account Dashboard after Logging in to No (it’s in the System->Configuration->Customer->Customer Configuration section).

Then make a small extension or if you already have made one add this part in the config.xml:


...
<frontend>
    <events>
        <observers>
            <controller_action_postdispatch_customer_account_loginPost>
                 <my_login_redirect>
                        <type>singleton</type>
                        <class>my_extension/observer</class>
                        <method>homeRedirect</method>
                 </my_login_redirect>
            </controller_action_postdispatch_customer_account_loginPost>
        </observers>
    </events>
</frontend>
...

This is the first part. We need to catch the event that signifies that login is finished, so we catch Magento’s controller postdispatch event on loginPostAction. Now we do the observer part that actually redirects our customer:

<?php
class My_Extension_Model_Observer{
    
    public function homeRedirect(Varien_Event_Observer $observer){
            Mage::app()->getResponse()->setRedirect(Mage::getUrl());
    }
}

And voila! Your customer will now be redirected to the home after he logs in. I will put the small extension for download later on.

Cheers 🙂

Comments

0 thoughts on “Magento 1 redirect to home page after login”

Tell us your opinion:

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