Magento支払いブロックカスタム情報
-
13-12-2019 - |
質問
注文の「作成日」を表示したい:
Sales -> Orders -> User -> Information -> Payment methods
.
このコードを使っています:
class Company_Module_Block_Info extends Mage_Payment_Block_Info
{
protected function _prepareSpecificInformation($transport = null)
{
if (null !== $this->_paymentSpecificInformation) {
return $this->_paymentSpecificInformation;
}
$info = $this->getInfo();
//Zend_Debug::dump($info); //List with created_at date
$transport = new Varien_Object();
$transport = parent::_prepareSpecificInformation($transport);
$transport->addData(array(
Mage::helper('payment')->__('Expiration date') => $info->getExpireDate(),
Mage::helper('sales')->__('Creation date') => $info->getCreatedAt(),
Mage::helper('payment')->__('Picked up by') => $info->getPickupCustomer()
));
return $transport;
}
}
.
働いていない行はこれです:
Mage::helper('sales')->__('Creation date') => $info->getCreatedAt(),
.
NULL
を与えるが、注文のカスタム作成日を返す予定です(YYYY-MM-DD HH:MM:SS)。Mage::getModel('sales/order')->getCollection()->getFirstItem(); $order->getCreatedAt();
を使用すると、最初に作成された最初の順序で最初に返されますが、選択した順序に必要です。
誰かが間違っているのは何も考えていますか?
解決
$info
は、Mage_Payment_Model_Info
またはMage_Sales_Model_Order_Payment
(Mage_Payment_Model_Info
を拡張する)のインスタンスを保持します。
取得したい作成日は、実際の受注の作成日ですが、情報モデルから入手しようとしています。
$info->getOrder()->getCreatedAt()
を呼び出す場合は、それが機能するはずです。
所属していません magento.stackexchange