0

何时发送单独的电子邮件模板(customer_password_forgot_email_template)

用户组 id=4 使用模块扩展 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;
    }

}

此代码有效,但我想要仅用于 groupid = 4 的单独邮件模板。

4

1 回答 1

0

工作答案点击收听

ravi.Asyou reweite customer class Mage_Customer_Model_Customer 然后 $this give customer object

在此功能中,如果使用以下代码,您可以获得客户:

  $this->getGroupId()

您还需要创建一个客户忘记密码其余密码电子邮件 html 模板并将其定义为 config.xml

Step1: 添加新客户forgot password confirmation mail template 使用this customer group

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>

通过这段代码,我添加了 新的电子邮件模板模板代码customer_password_forgot_email_template_groupnew

步骤 2:要获取此电子邮件模板,请在 config.xml 外部添加以下代码

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

Step3:需要调用这个模板at sendPasswordResetConfirmationEmail的rewrite函数

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);
      }

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

于 2014-09-18T09:43:24.920 回答