Magento-新订单通知电子邮件添加自定义字段-表sales_flat_order [英] Magento- new order notification email add custom field- table sales_flat_order

查看:62
本文介绍了Magento-新订单通知电子邮件添加自定义字段-表sales_flat_order的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在新订单电子邮件通知中添加自定义变量,该通知具有从表sales_flat_order(即Listened4us)填充的值.我该怎么办?

I would like to add custom variable on new order email notification having value populated from table sales_flat_order (i.e. heared4us ). How can I do this ?

我正在使用magento 1.7.0.2版

I am using magento version 1.7.0.2

谢谢.

推荐答案

要添加新字段以订购电子邮件,您需要执行以下2个步骤

To add new fields to order e-mail you need to follow the following 2 steps

1)编辑位于中的sendNewOrderEmail()函数

1) Edit sendNewOrderEmail() function located in

app/code/core/Mage/Sales/Model/Order.php

app/code/core/Mage/Sales/Model/Order.php

在该函数中,您将找到以下代码

In that function you will find following code

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

您需要添加新的键值对以添加新的自定义值

You need to add new key value pair to add new custom value

 $mailer->setTemplateParams(array(
          'order'        =>  $this,
          'billing'      =>  $this->getBillingAddress(),
          'payment_html' => $paymentBlockHtml,
          'customvalue'  => 'This is a custom value' //New custom value
       ));

2)现在是第二部分.您需要将自定义变量添加到新订单电子邮件模板中. 只需在模板上添加您的自定义参数名称即可.在示例中为"customvalue".

2) Now the second part. You need to add the custom variable to new order email template. Just edit the template add your custom parameter name. in the example it is "customvalue".

{{ var customvalue }}

对于英语,订购电子邮件模板位于

For English the order e-mail template is located in

  • app \ locale \ en_US \ template \ email \ sales \ order_new.html
  • app \ locale \ en_US \ template \ email \ sales \ order_new_guest.html

因此,根据网站中使用的语言,选择位于 locale 文件夹中的适当模板.

So depending on your language used in the website select the proper template located inside locale folder.

您还可以通过导航到

系统>交易电子邮件>新订单电子邮件

System > Transactional Emails > New Order Email

这篇关于Magento-新订单通知电子邮件添加自定义字段-表sales_flat_order的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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