为登录magento的客户创建一个观察者

时间:2013-04-10 10:03:14

标签: magento magento-1.7

如何在Magento中为客户登录创建observer

<events>
         <customer_login> <!-- identifier of the event we want to catch -->
           <observers>
             <Vi_Cartproduct> <!-- identifier of the event handler -->
               <type>singleton</type> <!-- class method call type; valid are model, object and singleton -->
               <class>cartproduct/observer</class> <!-- observers class alias -->
               <method>removeProduct</method>  <!-- observer's method to be called -->
               <args></args> <!-- additional arguments passed to observer -->
             </Vi_Cartproduct>
           </observers>
         </customer_login>
   </events>

上述事件无效

2 个答案:

答案 0 :(得分:2)

试试这个......

<events>
    <customer_login>
        <observers>
            <vi_cartproduct_model_observer>
                <type>singleton</type>
                <class>Vi_Cartproduct_Model_Observer</class>
                <method>removeProduct</method>
            </vi_cartproduct_model_observer>
        </observers>
    </customer_login>
</events>

答案 1 :(得分:1)

如果您只想自定义主题,您可以在布局中添加<customer_logged_in><customer_logged_out>句柄,以便添加或删除任何块。