Magento - 忘记密码链接生成使用了不正确的商店 View

标签 magento magento-1.7

有人知道我可以在哪里找到在发送给用户的电子邮件中生成忘记密码重置链接的功能吗?

出于某种奇怪的原因,我生成的重置密码链接的 URL 中的商店 View 与用于重置密码的商店 View 不同。

链接应该是:

example.com/customer/account/resetpassword/?id=555&token=55555555555555555

但它是这样生成的:

example.com/otherStoreView/customer/account/resetpassword/?id=555&token=55555555555555555

最佳答案

要解决此问题,请打开文件“app\code\local\Mage\Customer\Model\Customer.php”。

查找函数sendPasswordResetConfirmationEmail()。它位于 685 号线附近。

这个函数看起来像这样:

    /**
 * Send email with reset password confirmation link
 *
 * @return Mage_Customer_Model_Customer
 */
public function sendPasswordResetConfirmationEmail()
{
    $storeId = $this->getStoreId();
    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;
}

在此函数中,Magento 正在获取用户注册的商店 ID,但我们需要他发出密码重置请求的商店 ID。我们只需要删除一些行并添加一个新行:

public function sendPasswordResetConfirmationEmail()
{
    # this will get the current store ID
    $storeId = Mage::app()->getStore()->getStoreId();

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

    return $this;
}

这对我有用,我希望它有帮助。

关于Magento - 忘记密码链接生成使用了不正确的商店 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17411600/

相关文章:

php - 如何禁用 Magento 的简单产品 URL 重写管理?

Magento,按日期期间过滤集合并包含空值

php - 洋红色。按位置对产品集合进行排序

Magento - 客户地址国家下拉问题

php - 如何跟踪 Magento 从哪里调用模板?

linux - Magento 1.7 - 一台服务器中的两个magento相互影响

magento - 在magento中删除客户地址

SQL Magento 销售报告

Magento - 如何在查看 phtml 文件中向 friend 表单显示电子邮件

Magento "Forgot Password"电子邮件以错误的语言发送