Magento - customer_save_after always fired twice

前端 未结 5 1743
旧时难觅i
旧时难觅i 2020-12-08 22:36

I am using the customer_save_after event in magento, and all is working fine apart from 1 annoying thing - it is always fired twice.

There are no other

5条回答
  •  一个人的身影
    2020-12-08 22:58

    The difference between these 2 events is one of them can't get customer info, while the other can. So the solution is

        public function email_CustomerRegister(Varien_Event_Observer $observer){
    
            $customer = Mage::getSingleton('customer/session')->getCustomer();
            $customer_email                 = $customer->getEmail();
    
    
            if(empty($customer_email)){
                return;
            }
    
            // do something
        }
    

提交回复
热议问题