如何在 Order.php Magento 中更改订单电子邮件主题

How to change Order Email Subject in Order.php Magento

我想在 Magento 中更改 order.php 文件的订单电子邮件主题。

这是我的代码:

$mailSubject = "This is test subject";
Mage::getModel('core/email_template')->setTemplateSubject($mailSubject);
$translate = Mage::getSingleton('core/translate');

它不起作用。在 order.php

中是否还有其他设置主题的方法

我不想从后端设置“交易电子邮件”选项,因为 PHP 生成了一个值,我想在主题行中发送。

如有任何帮助,我们将不胜感激。

谢谢

转到>/app/locale/en_US/template/email/sales select 模板并直接更改主题

app/code/core/Mage/Sales/Model/Order.php中找到sendNewOrderEmail()方法。然后找到

$mailer->setTemplateParams(array(
        'order'        => $this,
        'billing'      => $this->getBillingAddress(),
        'payment_html' => $paymentBlockHtml
    )
);

=> 这是模板中的变量数组。为测试添加一个新参数:

'test' => $is_test ? $is_test : ''

=> 将 $is_test 更改为您的条件。例如:

public 函数 sendNewOrderEmail($is_test = FALSE)

现在打开模板文件app/locale/en_US/template/email/sales/order_new_guest.html(例如)。

在第一行找到主题变量:或类似这样的内容。

进行更改:

=>调用方法: $order->sendNewOrderEmail('TEST - ');

正确答案请参考以下URL

Magento - Custom subject of order email

并尝试通过自定义 magento module.Suppose 更改自定义设置 更新 magento 意味着它可能 导致一些问题 .

创建一个新的自定义模块并以正确的方式进行自定义。