0

How to send separate Email template (customer_password_forgot_email_template) when

user Group id=4 using module extend Mage_Customer_Model_Customer.

class Creative_Login_Model_Customer extends Mage_Customer_Model_Customer
{
    public function sendPasswordResetConfirmationEmail()
    {
        if (!$storeId) {
            $storeId = $this->_getWebsiteStoreId();
        }

        $this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
            array('customer' => $this), $storeId);
        return $this;
    }

}

This code working but i want separate mail template for only groupid= 4.

Community
  • 1
  • 1
Ravi Patel
  • 5,121
  • 2
  • 25
  • 44

1 Answers1

0

Working Answer Click Hear

ravi.As you reweite customer class Mage_Customer_Model_Customer and then $this give customer object

in this function you can get customer if by using below code :

  $this->getGroupId()

also you need create an customer forgort pasword rest password email html template and define it config.xml

Step1: add new customer forgot password confirmation mail template for this customer group using

below code at config.xml



<template>
        <email>
            <customer_password_forgot_email_template_groupnew translate="label" module="customer">
                <label>Forgot Password</label>
                <file>account_password_reset_confirmation_new.html</file>
                <type>html</type>
            </customer_password_forgot_email_template_groupnew>
        </email>
    </template>

by this code i have add new email template and template code is customer_password_forgot_email_template_groupnew

Step2: for getting this email template add below code at outside in config.xml

<default>
    <customer>
      <password>
                <forgot_email_template_newgroup>customer_password_forgot_email_template_groupnew</forgot_email_template_newgroup>
      </password>
    </customer>
</default>

Step3: you need to call this template at sendPasswordResetConfirmationEmail of rewrite function

if($this->getGroupId()==4) <!-- check your group id -->
     $this->_sendEmailTemplate('customer/password/forgot_email_template_newgroup', self::XML_PATH_FORGOT_EMAIL_IDENTITY,
            array('customer' => $this), $storeId);
      }
      else{
         $this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
            array('customer' => $this), $storeId);
      }

Step4: you to create new html name as account_password_reset_confirmation_new.html at app/locale/yourlanguage/template/email

Community
  • 1
  • 1
Ravi Patel
  • 5,121
  • 2
  • 25
  • 44