cancel
Showing results for 
Search instead for 
Did you mean: 

customer_login event is not firing observer

SOLVED

customer_login event is not firing observer

This is the first observer I'm writing. I'm testing the observer with the customer_login event that should fire when a user logs in. This are the files I created:

 

/app/etc/modules/EPS_CustomizationURL.xml

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

 

/app/code/local/EPS/CustomizationURL/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <EPS_CustomizationURL>
            <version>0.0.1</version>
        </EPS_CustomizationURL>
    </modules>
    <global>
        <models>
            <epscustomizationurl>
                <class>EPS_CustomizationURL_Model</class>
            </epscustomizationurl>
        </models>
        <events>
            <!-- observe the event -->
            <customer_login>
                <observers>
                    <eps_customizationurl_model_observer>
                        <type>model</type>
                        <class>epscustomizationurl/observer</class>
                        <method>epsURLCreator</method>
                    </eps_customizationurl_model_observer>
                </observers>
            </customer_login>
        </events>
    </global>
</config>

 

/app/code/local/EPS/CustomizationURL/Model/Observer.php

<?php 
class EPS_CustomizationURL_Model_Observer
{
    public function epsURLCreator($observer)
    {
    	Mage::log('I just made an Observer!', null, 'system.log', true);
    } 
}

 

When I log in with an user I don't see anything written on /var/log/system.log. What am I missing? I'm on Magento 1.9.2.2 with cache disabled:

 

enter image description here

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: customer_login event is not firing observer

Ok, first of all, thank you very much for the answer, the problem is really stupid now that I know what it is.

 

I was creating the files and folders through FTP. The permission on the files were right but I forgot to set the right permissions for the folders! As soon as I set the folder permissions to 775 it started working perfectly!

 

Thank you!

View solution in original post

3 REPLIES 3

Re: customer_login event is not firing observer

You have to keep below code in your config.xml file,

 

<?xml version="1.0"?>
<config>
    <modules>
        <EPS_CustomizationURL>
            <version>0.0.1</version>
        </EPS_CustomizationURL>
    </modules>
    <global>
        <models>
            <epscustomizationurl>
                <class>EPS_CustomizationURL_Model</class>
            </epscustomizationurl>
        </models>    
    </global>
    <frontend>
        <events>
            <!-- observe the event -->
            <customer_login>
                <observers>
                    <eps_customizationurl_model_observer>
                        <type>model</type>
                        <class>eps_customizationurl/observer</class>
                        <method>epsURLCreator</method>
                    </eps_customizationurl_model_observer>
                </observers>
            </customer_login>
        </events>
    </frontend>
</config>

Clear cache. Please let me know if you have query.

 

If answer helpful, Click Kudo and accept as solutions.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: customer_login event is not firing observer

Ok, first of all, thank you very much for the answer, the problem is really stupid now that I know what it is.

 

I was creating the files and folders through FTP. The permission on the files were right but I forgot to set the right permissions for the folders! As soon as I set the folder permissions to 775 it started working perfectly!

 

Thank you!

Re: customer_login event is not firing observer