/** * Method raised when a new customer is registered * * This event listener must check if new user's email is contained * in any Referral Program row. * * If is it, respective coupons will be assigned if relative * ReferralRule is designed as it * * @param CustomerRegisterEvent $event Event containing referral data */ public function onCustomerRegister(CustomerRegisterEvent $event) { $hash = $this->getReferralProgramCookieHash(); if (!empty($hash)) { $customer = $event->getCustomer(); $this->referralCouponManager->checkCouponAssignment($customer, $hash, ElcodiReferralProgramRuleTypes::TYPE_ON_REGISTER); } }
/** * Send email * * @param CustomerRegisterEvent $event Event */ public function sendCustomerRegistrationEmail(CustomerRegisterEvent $event) { $customer = $event->getCustomer(); $this->sendEmail('customer_registration', ['customer' => $customer], $customer->getEmail()); }