Magento电子邮件模板 [英] Magento Email Templates

查看:79
本文介绍了Magento电子邮件模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为客户订单"设置不同的电子邮件模板?确认电子邮件模板和相同的管理员副本.

How can I set different email templates for Customer Order Confirm email and Admin copy of the same.

我需要为管理员电子邮件副本添加一些额外的内容.

I need to add some extra content for the Admin email copy.

谢谢

推荐答案

我假设您当前正在使用复制"功能发送管理员电子邮件.让我知道是否不是这种情况.因为当前同一封电子邮件正在发送给多个收件人,所以很难为每个收件人更改内容.不过,您可以发送带有少量代码的多封电子邮件,这将使您可以为每个电子邮件模板使用不同的电子邮件模板.这可以通过创建一个新类来实现:

I am assuming that you are currently using the "copy" feature to send the admin email. Let me know if that's not the case. Because the same email is currently being sent to multiple recipients, it would be difficult to change the content for each recipient. You could send multiple emails with a little bit of code, though, which would allow you to use a different email template for each. This could be achieved by creating a new class:

class MyModule_Model_Sales_Order extends Mage_Sales_Model_Order {

    /**
     * Sending email with order data
     *
     * @return Mage_Sales_Model_Order
     */
    public function sendNewOrderEmail() {
        parent::sendNewOrderEmail();

        /**
         * Your admin email sending code here. Copy it out of the sendNewOrderEmail
         * function in Sales_Order.
         */

        return $this;
    }
}

然后告诉Magento覆盖模块配置中的核心类:

And then telling Magento to override the core class inside your module config:

<config>
    <global>
        <models>
            <mymodule>
                <class>MyModule_Model</class>
            </mymodule>
            <sales>
                <rewrite>
                    <order>MyModule_Model_Sales_Order</order>
                </rewrite>
            </sales>
        </models>
    </global>
</config>

您需要创建所需的模板,并确保您覆盖的模型改用该模板.

You'll need to create the template you want and be sure that your overridden model uses that template instead.

这篇关于Magento电子邮件模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆