Skip to main content
added 90 characters in body
Source Link
Sohel Rana
  • 36.1k
  • 3
  • 72
  • 91
<config>
<global>
    <models>
        <csv>
            <class>Training_Csv_Model</class>
        </csv>
    </models>

    <events>
        <customer_login>
            <observers>
                <csv>
                    <type>model</type>
                    <class>csv/observer</class>
                    <method>logCSV</method>
                </csv>
            </observers>
        </customer_login>
    </events>
</global>

<config>
    <global>
        <models>
            <csv>
                <class>Training_Csv_Model</class>
            </csv>
        </models>

        <events>
            <customer_login>
                <observers>
                    <csv>
                        <type>model</type>
                        <class>csv/observer</class>
                        <method>logCSV</method>
                    </csv>
                </observers>
            </customer_login>
        </events>
    </global>
</config>
class Training_Csv_Model_Observer{
    public function logCSV($observer){
    $customer = $observer->getCustomer();
    Mage::log($customer->getName()." has logged in", 
                null,
                "customer.log");
    
    }
}

    class Training_Csv_Model_Observer{
        public function logCSV($observer){
        $customer = $observer->getCustomer();
        Mage::log($customer->getName()." has logged in", 
                    null,
                    "customer.log");
        
        }
    }
<config>
<global>
    <models>
        <csv>
            <class>Training_Csv_Model</class>
        </csv>
    </models>

    <events>
        <customer_login>
            <observers>
                <csv>
                    <type>model</type>
                    <class>csv/observer</class>
                    <method>logCSV</method>
                </csv>
            </observers>
        </customer_login>
    </events>
</global>
class Training_Csv_Model_Observer{
    public function logCSV($observer){
    $customer = $observer->getCustomer();
    Mage::log($customer->getName()." has logged in", 
                null,
                "customer.log");
    
    }
}

<config>
    <global>
        <models>
            <csv>
                <class>Training_Csv_Model</class>
            </csv>
        </models>

        <events>
            <customer_login>
                <observers>
                    <csv>
                        <type>model</type>
                        <class>csv/observer</class>
                        <method>logCSV</method>
                    </csv>
                </observers>
            </customer_login>
        </events>
    </global>
</config>

    class Training_Csv_Model_Observer{
        public function logCSV($observer){
        $customer = $observer->getCustomer();
        Mage::log($customer->getName()." has logged in", 
                    null,
                    "customer.log");
        
        }
    }
updated the code
Source Link
localhost
  • 249
  • 1
  • 4
  • 17

I am learning observers and events, but following a simple event, i am unable to disect the problem, as to me it seems fine, and nothing in system.log as well. Following is my module etc/config.xml

<config>
<global>
    <models>
    <events>    <csv>
          <global>  <class>Training_Csv_Model</class>
        </csv>
    <customer_login></models>

    <events>
        <customer_login>
    <observers>
        <observers>
            <csv>
    <csv>
                    <type>model</type>
                        <class>csv/observer</class>
                        <method>logCSV</method>
                    </csv>
                </observers>
            </customer_login>
        </events>
 <global>
</config>global>
  

while my observer.php file is under Name_space/module_name/Model/Observer.php and has following code

class Training_Csv_Model_Observer{
    public function logCSV($observer){
    $customer = $observer->getCustomer();
    Mage::log($customer->getName()." has logged in", 
                null,
                "customer.log");
    
    }
}

I am unable to understand why this wouldn't work, as a simple Model would work, meaning my module is working and loading. My knowledge of PHP is limited and i want to know, why this won't work.

I am learning observers and events, but following a simple event, i am unable to disect the problem, as to me it seems fine, and nothing in system.log as well. Following is my module etc/config.xml

<config>
        <events>
          <global>
            <customer_login>
                <observers>
                    <csv>
                        <type>model</type>
                        <class>csv/observer</class>
                        <method>logCSV</method>
                    </csv>
                </observers>
            </customer_login>
        </events>
 <global>
</config>
 

while my observer.php file is under Name_space/module_name/Model/Observer.php and has following code

class Training_Csv_Model_Observer{
    public function logCSV($observer){
    $customer = $observer->getCustomer();
    Mage::log($customer->getName()." has logged in", 
                null,
                "customer.log");
    
    }
}

I am unable to understand why this wouldn't work, as a simple Model would work, meaning my module is working and loading. My knowledge of PHP is limited and i want to know, why this won't work.

I am learning observers and events, but following a simple event, i am unable to disect the problem, as to me it seems fine, and nothing in system.log as well. Following is my module etc/config.xml

<config>
<global>
    <models>
        <csv>
            <class>Training_Csv_Model</class>
        </csv>
    </models>

    <events>
        <customer_login>
            <observers>
                <csv>
                    <type>model</type>
                    <class>csv/observer</class>
                    <method>logCSV</method>
                </csv>
            </observers>
        </customer_login>
    </events>
</global>
 

while my observer.php file is under Name_space/module_name/Model/Observer.php and has following code

class Training_Csv_Model_Observer{
    public function logCSV($observer){
    $customer = $observer->getCustomer();
    Mage::log($customer->getName()." has logged in", 
                null,
                "customer.log");
    
    }
}

I am unable to understand why this wouldn't work, as a simple Model would work, meaning my module is working and loading. My knowledge of PHP is limited and i want to know, why this won't work.

Source Link
localhost
  • 249
  • 1
  • 4
  • 17

Simple Observer not firing on event

I am learning observers and events, but following a simple event, i am unable to disect the problem, as to me it seems fine, and nothing in system.log as well. Following is my module etc/config.xml

<config>
        <events>
          <global>
            <customer_login>
                <observers>
                    <csv>
                        <type>model</type>
                        <class>csv/observer</class>
                        <method>logCSV</method>
                    </csv>
                </observers>
            </customer_login>
        </events>
 <global>
</config>

while my observer.php file is under Name_space/module_name/Model/Observer.php and has following code

class Training_Csv_Model_Observer{
    public function logCSV($observer){
    $customer = $observer->getCustomer();
    Mage::log($customer->getName()." has logged in", 
                null,
                "customer.log");
    
    }
}

I am unable to understand why this wouldn't work, as a simple Model would work, meaning my module is working and loading. My knowledge of PHP is limited and i want to know, why this won't work.