Is there an event for customer account registration in Magento?

后端 未结 17 1962
轻奢々
轻奢々 2020-12-04 17:23

I would like to be able to run some functionality with a module that I am building whenever a customer registers an account, but I can\'t seem to f

17条回答
  •  既然无缘
    2020-12-04 17:40

    There isn't a direct event for this, but you could use the customer_save_commit_after event. This event also guarantees you that the customer is save in the shop's database. The problem with this event is that is triggered twice. Bellow is an hack that allows you to use this event - the observer function is listed:

    public function customer_save_commit_after($p_oObserver) {
    
        $l_oCustomer = $p_oObserver->getCustomer();
    
        if ($l_oCustomer->isObjectNew() && !$l_oCustomer->getMyCustomKeyForIsAlreadyProcessed()) {
            $l_oCustomer->setMyCustomKeyForIsAlreadyProcessed(true);
            // new customer
        }
        else {
            // existing customer
        }
    
        return false;
    
    }
    

    Hope this helps someone!

提交回复
热议问题