【问题标题】:How to get Order Time in Magento?如何在 Magento 中获取订单时间?
【发布时间】:2012-09-14 11:06:19
【问题描述】:

我正在尝试在 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');

仅结合日期显示时间。

【问题讨论】:

    标签: date pdf time magento-1.7 invoice


    【解决方案1】:

    仅显示时间部分的一种方法是:

    $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 类进行日期/时间操作。

    参数信息见app/code/core/Zend/Date.phptoString()方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多