电子邮件模板 magento 1.9.1.0 中未显示客户密码

customer's password not displayed in email templates magento 1.9.1.0

我在电子邮件中显示密码时遇到问题 (account_new.html)

<strong>Email</strong>: {{var customer.email}}<br/>
<strong>Password</strong>: {{htmlescape var=$customer.password}}<p>

注册后密码没有显示在模板中。 我怎样才能解决这个问题?我使用 magento 1.9.1.0

这是不可能的,因为密码将以加密格式存储。 它是不可逆的格式。

通过邮件发送密码不是最佳做法。 你必须遵循最佳实践,即使你的客户坚持要你做这件事。这种事情你得说服他不要去。

因为客户在注册过程中提供了密码。显然他知道他的密码。如果他忘记了,那么他可以使用忘记的密码来获取他的新密码。

无论如何,我不会建议您通过电子邮件发送密码,对不起。

Magento 1.9 版本无法通过电子邮件发送密码。 并且不在 {{htmlescape var=$customer.password}}

下设置 var 值

有一种方法可以通过电子邮件发送密码

随意打开核心文件或扩展AccountController.php, 在第 285 行找到函数 createPostAction() 或找到

$customer->cleanPasswordsValidationData();

就这样评论吧

// $customer->cleanPasswordsValidationData();

其他地方也可以,比如809、954行

现在它将密码发送到客户的新帐户电子邮件。

其他方法

打开或扩展自定义模型文件

magento\app\code\core\Mage\Customer\Model\Customer.php

找到函数

public function cleanPasswordsValidationData()
{
    $this->setData('password', null);
    $this->setData('password_confirmation', null);
    return $this;
} 

注释掉// $this->setData('password', null);

public function cleanPasswordsValidationData()
{
    // $this->setData('password', null);
    $this->setData('password_confirmation', null);
    return $this;
}