protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { $this->_getSession()->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())); if ($this->_isVatValidationEnabled()) { $configAddressType = Mage::helper('customer/address')->getTaxCalculationAddressType(); $userPrompt = ''; switch ($configAddressType) { case Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you shipping address for proper VAT calculation', Mage::getUrl('customer/address/edit')); break; default: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you billing address for proper VAT calculation', Mage::getUrl('customer/address/edit')); } $this->_getSession()->addSuccess($userPrompt); } $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()->getStore()->getId()); $cusromerRedirectStatus = Mage::getStoreConfig('customer/customercreateredirect/active'); $customerCreateRedirectUrl = Mage::getStoreConfig('customer/customercreateredirect/redirecturl'); if ($cusromerRedirectStatus == 1) { $successUrl = Mage::getUrl() . $customerCreateRedirectUrl; } else { $successUrl = Mage::getUrl('*/*/index', array('_secure' => true)); } if ($this->_getSession()->getBeforeAuthUrl()) { if ($cusromerRedirectStatus == 1) { $successUrl = Mage::getUrl() . $customerCreateRedirectUrl; } else { $successUrl = $this->_getSession()->getBeforeAuthUrl(true); } } return $successUrl; }
protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { $this->_getSession()->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())); if ($this->_isVatValidationEnabled()) { // Show corresponding VAT message to customer $configAddressType = Mage::helper('customer/address')->getTaxCalculationAddressType(); $userPrompt = ''; switch ($configAddressType) { case Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you shipping address for proper VAT calculation', Mage::getUrl('customer/address/edit')); break; default: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you billing address for proper VAT calculation', Mage::getUrl('customer/address/edit')); } $this->_getSession()->addSuccess($userPrompt); } $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()->getStore()->getId()); if (Mage::getModel("bmicalculator/bmi")->getMyw8status()) { $successUrl = Mage::getUrl("bmicalculator/index/myw8", array('_secure' => true)); } else { $successUrl = Mage::getUrl("customer/account/edit", array('_secure' => true)); } // $successUrl = Mage::getUrl("bmicalculator/index/myw8", array('_secure'=>true)); if ($this->_getSession()->getBeforeAuthUrl()) { $successUrl = $this->_getSession()->getBeforeAuthUrl(true); } return $successUrl; }
/** * overwrites the default function * * @param string $type * @param string $backUrl * @param string $storeId * * @return Mage_Customer_Model_Customer|void */ public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0') { if (Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DISABLE_CUSTOMER_SUCCESS, $storeId)) { return; } parent::sendNewAccountEmail($type, $backUrl, $storeId); }
/** * Verifying the referral link registration */ public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0') { $customer = $this; $helper = Mage::helper('referralreward'); if ($helper->isEnabled() && ($type == 'registered' || $type == 'confirmed')) { $invitelink = Mage::app()->getRequest()->getParam('friend_invitelink'); $sessionMark = Mage::getSingleton('customer/session')->getReferralInvitedCustomer(); if ($invitelink || $sessionMark) { if ($invitelink) { $pointsItem = Mage::getModel('referralreward/points')->getItemByUrl($invitelink); } else { $pointsItem = Mage::getModel('referralreward/points')->getItemByUrl($sessionMark); } $friend = Mage::getModel('referralreward/friends')->getItem($pointsItem->getCustomerId(), $customer->getEmail()); if ($friend->getId()) { $friend->setStatus(Belvg_Referralreward_Model_Friends::FRIEND_BRING)->save(); } else { $data = array(); $data['friend_name'] = $customer->getFirstname() . ' ' . $customer->getLastname(); $data['friend_email'] = $customer->getEmail(); $data['customer_id'] = $pointsItem->getCustomerId(); $data['status'] = Belvg_Referralreward_Model_Friends::FRIEND_BRING; $friend->setData($data)->save(); } $collection = Mage::getModel('referralreward/friends')->getOtherItems($pointsItem->getCustomerId(), $customer->getEmail()); $collection->setDataToAll('status', Belvg_Referralreward_Model_Friends::FRIEND_NO_BRING)->save(); } $helper->createNewPointsObject($customer->getId()); $helper->getLogModel(Belvg_Referralreward_Model_Points_Log::TYPE_CUSTOMER_REGISTRATION)->supplementPoints($customer); } return parent::sendNewAccountEmail($type, $backUrl, $storeId); }
/** * Save customer * * @param Mage_Customer_Model_Customer $order */ protected function _saveCustomerAfterOrder($order) { if ($this->_customer) { if (!$this->_customer->getId()) { $this->_customer->save(); $order->setCustomerId($this->_customer->getId()); $this->getBillingAddress()->setCustomerId($this->_customer->getId()); $this->getShippingAddress()->setCustomerId($this->_customer->getId()); $this->_customer->sendNewAccountEmail(); } else { $saveCusstomerAddress = false; if ($this->getBillingAddress()->getSaveInAddressBook()) { $billingAddress = $this->getBillingAddress()->exportCustomerAddress(); if ($this->getBillingAddress()->getCustomerAddressId()) { $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($billingAddress); $saveCusstomerAddress = true; } if ($this->getShippingAddress()->getSaveInAddressBook()) { $shippingAddress = $this->getShippingAddress()->exportCustomerAddress(); if ($this->getShippingAddress()->getCustomerAddressId()) { $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($shippingAddress); $saveCusstomerAddress = true; } if ($saveCusstomerAddress) { $this->_customer->save(); } } } }
public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0') { parent::sendNewAccountEmail($type, $backUrl, $storeId); if ($type == 'registered' || $type == 'confirmed') { Mage::dispatchEvent('ug_new_customer_campaign_info', array('customer' => $this)); } return $this; }
/** * Send email with new account related information * * @param string $type * @param string $backUrl * @param string $storeId * @throws Mage_Core_Exception * @return Mage_Customer_Model_Customer */ public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0') { if (Mage::app()->getRequest()->getParam('check_seller_form')) { $types = array('registered' => self::XML_PATH_REGISTER_SELLER_EMAIL_TEMPLATE, 'confirmed' => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE, 'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE); if (!isset($types[$type])) { Mage::throwException(Mage::helper('customer')->__('Wrong transactional account email type')); } if (!$storeId) { $storeId = $this->_getWebsiteStoreId($this->getSendemailStoreId()); } $this->_sendEmailTemplate($types[$type], self::XML_PATH_REGISTER_EMAIL_IDENTITY, array('customer' => $this, 'back_url' => $backUrl), $storeId); return $this; } return parent::sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0'); }
/** * Save customer * * @deprecated after 1.4.0.0. * @param Mage_Customer_Model_Customer $order */ protected function _saveCustomerAfterOrder($order) { if ($this->_customer) { if (!$this->_customer->getId()) { $billing = $this->getBillingAddress(); $customerBilling = $billing->exportCustomerAddress(); $shipping = $this->getShippingAddress(); $customerShipping = $shipping->exportCustomerAddress(); $this->_customer->addAddress($customerBilling); if (!$shipping->getSameAsBilling()) { $this->_customer->addAddress($customerShipping); } // preliminary save to find addresses id $this->_customer->save(); // setting default addresses id $defShipping = $shipping->getSameAsBilling() ? $customerBilling->getId() : $customerShipping->getId(); $this->_customer->setDefaultBilling($customerBilling->getId())->setDefaultShipping($defShipping)->save(); $order->setCustomerId($this->_customer->getId()); $billing->setCustomerId($this->_customer->getId()); $shipping->setCustomerId($this->_customer->getId()); $this->_customer->sendNewAccountEmail('registered', '', $order->getStoreId()); } else { $saveCusstomerAddress = false; if ($this->getBillingAddress()->getSaveInAddressBook()) { $billingAddress = $this->getBillingAddress()->exportCustomerAddress(); if ($this->getBillingAddress()->getCustomerAddressId()) { $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($billingAddress); $saveCusstomerAddress = true; } if ($this->getShippingAddress()->getSaveInAddressBook()) { $shippingAddress = $this->getShippingAddress()->exportCustomerAddress(); if ($this->getShippingAddress()->getCustomerAddressId()) { $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($shippingAddress); $saveCusstomerAddress = true; } if ($saveCusstomerAddress) { $this->_customer->save(); } } } }
public function connectByCreatingAccount(Mage_Customer_Model_Customer $customer, $email, $firstName, $lastName, $googleId, $token) { /*New customer and order set source and campaign*/ $gaCookies = Mage::getModel('nosql/parse_ga')->getCookies(); if (!is_array($gaCookies) || count($gaCookies) <= 0) { $gaCookies = Mage::helper('common')->getCustomCookies(); } $source = strtolower($gaCookies['campaign']['source']); $campaign = strtolower($gaCookies['campaign']['name']); $customer->setEmail($email)->setFirstname($firstName)->setLastname($lastName)->setSource($source)->setCampaign($campaign)->setInchooGoogleconnectId($googleId)->setInchooGoogleconnectToken($token)->setPassword($customer->generatePassword(10))->save(); $customer->setConfirmation(null); $customer->save(); $customer->sendNewAccountEmail(); Mage::getSingleton('core/session')->setNewRegistrationUser('complete'); $name = 'nw_user_reg_up'; $ck_reg = Mage::getModel('core/cookie')->get($name); if ($ck_reg == 'ap56767es') { Mage::getModel('core/cookie')->set('nw_user_reg', 'ap567es', 3600, '/', null, null, false); } Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer); }
/** * Add welcome message and send new account email. * Returns success URL * * @param Mage_Customer_Model_Customer $customer * @param bool $isJustConfirmed * @return string */ protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { $this->_getSession()->addSuccess($this->__('Thank you for registering with %s', Mage::app()->getStore()->getName())); $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered'); $successUrl = Mage::getUrl('*/*/index', array('_secure' => true)); if ($this->_getSession()->getBeforeAuthUrl()) { $successUrl = $this->_getSession()->getBeforeAuthUrl(true); } return $successUrl; }
/** * Function to display welcome message * * Display welcome message for seller/ customer * * @return void */ protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { Mage::getSingleton('customer/session')->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())); if ($this->_isVatValidationEnabled()) { /** * Show corresponding VAT message to customer */ $configAddressType = Mage::helper('customer/address')->getTaxCalculationAddressType(); $userPrompt = ''; if ($configAddressType == Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING) { $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you shipping address for proper VAT calculation', Mage::getUrl('customer/address/edit')); } else { $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you billing address for proper VAT calculation', Mage::getUrl('customer/address/edit')); } /** add success message in session */ Mage::getSingleton('customer/session')->addSuccess($userPrompt); } $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()->getStore()->getId()); $successUrl = Mage::getUrl('*/*/index', array('_secure' => true)); if (Mage::getSingleton('customer/session')->getBeforeAuthUrl()) { $successUrl = Mage::getSingleton('customer/session')->getBeforeAuthUrl(true); } /** return url */ return $successUrl; }
/** * Success Registration * * @param Mage_Customer_Model_Customer $customer * @return Mage_Customer_AccountController */ protected function _successProcessRegistrationJson(Mage_Customer_Model_Customer $customer) { $response = array(); $session = $this->_getSession(); if ($customer->isConfirmationRequired()) { /** @var $app Mage_Core_Model_App */ $app = $this->_getApp(); /** @var $store Mage_Core_Model_Store*/ $store = $app->getStore(); $customer->sendNewAccountEmail('confirmation', $session->getBeforeAuthUrl(), $store->getId()); $customerHelper = $this->_getHelper('customer'); $response['error'] = $this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', $customerHelper->getEmailConfirmationUrl($customer->getEmail())); $response['redirect'] = $this->_getUrl('*/*/index', array('_secure' => true)); } else { $session->setCustomerAsLoggedIn($customer); $response['redirect'] = $this->_welcomeCustomer($customer); } $this->_echoJson($response); }
protected function _successProcessRegistration(Mage_Customer_Model_Customer $customer) { $session = $this->_getSession(); if ($customer->isConfirmationRequired()) { /** @var $app Mage_Core_Model_App */ $app = $this->_getApp(); /** @var $store Mage_Core_Model_Store*/ $store = $app->getStore(); $customer->sendNewAccountEmail('confirmation', $session->getBeforeAuthUrl(), $store->getId()); $customerHelper = $this->_getHelper('customer'); //session //$session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', //$customerHelper->getEmailConfirmationUrl($customer->getEmail()))); //ito yun dinagdag ko para auto login $session->setCustomerAsLoggedIn($customer); $session->renewSession(); $url = $this->_welcomeCustomer($customer); } else { $session->setCustomerAsLoggedIn($customer); $session->renewSession(); $url = $this->_welcomeCustomer($customer); } $this->_redirectSuccess($url); return $this; }
/** * Customer welcome function * * Its used for print welcome message once successfully logged in * * @return string customer success page URL. */ public function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { /** * Throws the welcome success message when customer registered successfully */ $this->_getCustomerSession()->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())); /** * Send the welcome mail to the customer registered email */ $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()->getStore()->getId()); $successUrl = Mage::getUrl('customer/account', array('_secure' => true)); if ($this->_getCustomerSession()->getBeforeAuthUrl()) { $successUrl = $this->_getCustomerSession()->getBeforeAuthUrl(true); } return $successUrl; }
protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { $text = "<p>" . $this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName()) . "</p>"; if ($this->_isVatValidationEnabled()) { // Show corresponding VAT message to customer $configAddressType = Mage::helper('customer/address')->getTaxCalculationAddressType(); $userPrompt = ''; switch ($configAddressType) { case Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you shipping address for proper VAT calculation', Mage::getUrl('customer/address/edit')); break; default: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you billing address for proper VAT calculation', Mage::getUrl('customer/address/edit')); } $this->_getSession()->addSuccess($userPrompt); } $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()->getStore()->getId()); return $text . "<p>" . $userPrompt . "</p>"; }
/** * Send welcome email to customer * * @param Mage_Customer_Model_Customer $customer * @param array $customerData * @return Mage_Customer_Service_Customer */ protected function _sendWelcomeEmail($customer, array $customerData) { if ($customer->getWebsiteId() && ($this->_isSendEmail($customerData) || $this->_isAutogeneratePassword($customerData))) { $isNewCustomer = !(bool) $customer->getOrigData($customer->getIdFieldName()); $storeId = $customer->getSendemailStoreId(); if ($isNewCustomer) { $customer->sendNewAccountEmail('registered', '', $storeId); } elseif (!$customer->getConfirmation()) { // Confirm not confirmed customer $customer->sendNewAccountEmail('confirmed', '', $storeId); } } return $this; }
/** * Add welcome message and send new account email. * Returns success URL * * @param Mage_Customer_Model_Customer $customer * @param bool $isJustConfirmed * @return string */ protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { $this->_getSession()->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())); if ($this->_isVatValidationEnabled()) { // Show corresponding VAT message to customer $configAddressType = Mage::helper('Mage_Customer_Helper_Address')->getTaxCalculationAddressType(); $userPrompt = ''; switch ($configAddressType) { case Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you shipping address for proper VAT calculation', Mage::getUrl('customer/address/edit')); break; default: $userPrompt = $this->__('If you are a registered VAT customer, please click <a href="%s">here</a> to enter you billing address for proper VAT calculation', Mage::getUrl('customer/address/edit')); } $this->_getSession()->addSuccess($userPrompt); } $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()->getStore()->getId()); $successUrl = Mage::getUrl('*/*/index', array('_secure' => true)); if (!Mage::getStoreConfigFlag(Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD) && $this->_getSession()->getBeforeAuthUrl()) { $successUrl = $this->_getSession()->getBeforeAuthUrl(true); } return $successUrl; }
/** * Set customers basic data like name, gender etc. * * @param Mage_Customer_Model_Customer $magentoCustomer * @param ShopgateCustomer $shopgateCustomer * * @return Mage_Customer_Model_Customer $magentoCustomer */ protected function _registerSetBasicData($magentoCustomer, $shopgateCustomer) { $magentoCustomer->setConfirmation(null); $magentoCustomer->setFirstname($shopgateCustomer->getFirstName()); $magentoCustomer->setLastname($shopgateCustomer->getLastName()); $magentoCustomer->setGender($this->getMagentoCustomerGender($shopgateCustomer->getGender())); $magentoCustomer->setDob($shopgateCustomer->getBirthday()); $magentoCustomer->setForceConfirmed(true); $magentoCustomer->save(); $magentoCustomer->sendNewAccountEmail('registered', '', $magentoCustomer->getStore()->getId()); return $magentoCustomer; }