Is there an event for customer account registration in Magento?

后端 未结 17 2000
轻奢々
轻奢々 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:55

    You have to consider also when the user register on-the-fly on checkout: a Register on chekout. Thinking on this case, you can catch the "checkout_type_onepage_save_order_after" event with your own Observer class, and then this code...

    
    if($observer->getEvent()->getQuote()->getCheckoutMethod(true) == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER){
        (...)
    }

    Anybody may say: Mage_Sales_Model_Quote->getCheckoutMethod() is deprecated since 1.4!!,but:

  • If we call the ortodox method Mage_Checkout_Model_Type_Onepage->getCheckoutMethod(), waiting for something as "METHOD_REGISTER" this is executed:

    if ($this->getCustomerSession()->isLoggedIn()) {
                return self::METHOD_CUSTOMER;
            }

    ... "METHOD_CUSTOMER" is the name for a checkout with an already registrated user, not our case.... but yes!, because....

  • ...the registration operation is perfomed before "checkout_type_onepage_save_order_after" event. Then we a have a METHOD_CUSTOMER now. Ups, something inconsistent?

  • Fortunatly, the Quote remains with the original value: CHECKOUT_METHOD_REGISTER

    Any other idea for the registration on checkout?

提交回复
热议问题