我正在尝试在 Magento 中重写我的 PDF 发票。如何在没有订单日期的情况下显示创建时间?
我正在/app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php 中准备类 insertOrder()。
$page->drawText(Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'short', false), 100, 100, 'UTF-8');
仅显示时间与日期的组合。
最佳答案
仅显示时间部分的一种方法是:
$sTime = Mage::app()
->getLocale()
->date(strtotime($order->getCreatedAtStoreDate()), null, null, false)
->toString('H:m:s');
$page->drawText($sTime, 100, 100, 'UTF-8');
Magento 的语言环境使用修改后的
Zend_Date
日期/时间操作类。见
toString()
app/code/core/Zend/Date.php
的方法用于参数信息。
关于date - 如何在 Magento 中获取订单时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12540465/