Magento如何在电子邮件模板中格式化日期 [英] Magento How to Format Date in an Email Template

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

问题描述

我需要在电子邮件模板中格式化日期。日期被包含在普通的 .html 电子邮件中,如下所示:

I need to format the date in an email template. The date gets included in the plain .html email as follows:

Dispatch Date: {{var order.getShippingDate()}}

有没有办法我可以格式化日期?我已经尝试使用标准的PHP date 函数将其格式化为无效。

Is there any way I can format this date? I've tried just using the standard PHP date function to format it to no avail.

推荐答案

strtotime任何帮助?它可以将数据解析为unix时间戳,这是date()期望作为输入。

strtotime any help? It can parse a data back to a unix timestamp, which is what date() expects as an input.

在评论后编辑:

您可以尝试在应用程序/代码/本地文件夹下创建应用程序/代码/核心/ Mage / Sales / Model / Order.php的自定义版本(这样,magento更新不会覆盖它) 。它包含一个称为getCreatedAtFormated的方法 - 您可以将相同的原则应用于运输数据,看看是否达到您需要做的。

You can try creating a custom version of app/code/core/Mage/Sales/Model/Order.php under the app/code/local folder (it goes here so magento updates don't overwrite it). It contains a method called getCreatedAtFormated - you could apply the same principle to the shipping data and see if that achieves what you need to do.

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

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