Magento-订单电子邮件的自定义主题 [英] Magento - Custom subject of order email
问题描述
我有一个PHP服务,可与Magento网站进行交互.我无法访问该网站的源代码.因此,我可以使用服务订购产品并发送邮件.当我打电话
I have a service in PHP which interacts with a Magento website. I can't access the source code of this website. So I can use service to order a product and send a mail. When I call
$order->sendNewOrderEmail();
一封电子邮件将发送给我的电子邮件ID,主题为Nuovo ordine # XXXXXXXXX
.
an email will be send to my email-id with subject Nuovo ordine # XXXXXXXXX
.
现在,我想向此主题添加一个字符串:TEST - Nuovo ordine # XXXXXXXXX
.
Now I want add a string to this subject: TEST - Nuovo ordine # XXXXXXXXX
.
我该怎么做?
推荐答案
在app/code/core/Mage/Sales/Model/Order.php
中找到sendNewOrderEmail()
方法.然后找到
In app/code/core/Mage/Sales/Model/Order.php
find sendNewOrderEmail()
method. Then find
$mailer->setTemplateParams(array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlockHtml
)
);
这里是模板中的变量数组.添加一个新的参数进行测试:
Here is array of variables from template. Add one new param for test:
'test' => $is_test ? $is_test : ''
将$is_test
更改为您的条件.例如:
Change $is_test
to your condition. For example:
public function sendNewOrderEmail($is_test = FALSE)
现在打开您的模板文件app/locale/en_US/template/email/sales/order_new_guest.html
(例如).
Now open your template file app/locale/en_US/template/email/sales/order_new_guest.html
(for example).
在第一行上找到主题变量:<!--@subject Nuovo ordine # {{var order.increment_id}} @-->
或类似的内容.
Find subject variable on the first line: <!--@subject Nuovo ordine # {{var order.increment_id}} @-->
or something like this.
进行更改:
<!--@subject {{var is_test}}Nuovo ordine # {{var order.increment_id}} @-->
调用方法:
$order->sendNewOrderEmail('TEST - ');
这篇关于Magento-订单电子邮件的自定义主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!