这是代码-
app / etc / modules / Ds_Customerlog.xml-
<?xml version="1.0"?>
<config>
<modules>
<Ds_Customerlog>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</Ds_Customerlog>
</modules>
</config>
app / code / local / Ds / Customerlog / etc / config.xml-
<?xml version="1.0"?>
<config>
<modules>
<Ds_Customerlog>
<version>0.1.0</version>
</Ds_Customerlog>
</modules>
<global>
<helpers>
<customerlog>
<class>Ds_Customerlog_Helper</class>
</customerlog>
</helpers>
<models>
<ds_customerlog>
<class>Ds_Customerlog_Model</class>
</ds_customerlog>
</models>
<events>
<customer_register_success> <!-- identifier of the event we want to catch -->
<observers>
<customer_register_success_handler> <!-- identifier of the event handler -->
<class>Ds_Customerlog_Model_Observer</class> <!-- observers class alias -->
<method>observer</method> <!-- observer's method to be called -->
</customer_register_success_handler>
</observers>
</customer_register_success>
</events>
</global>
</config>
应用程序/代码/本地/Ds/Customerlog/Model/Observer.php -
<?php
class Ds_Customerlog_Model_Observer
{
public function observer(Varien_Event_Observer $observer)
{
die("sfs");
$customer = $observer->getEvent()->getCustomer();
Mage::log($customer->getFirstname(), null, 'customer.log');
}
}
此处die("sfs")
不在前端和后端的客户注册上执行。
任何帮助,将不胜感激。