2016-12-25 41 views
1

我需要通過info.phtml文件在客戶頁面的訂單明細屏幕上顯示當前訂單增量ID。在info.phtml頁面上獲取客戶明細訂單中的增量ID

如果我使用$this->getOrder();$this->getOrderId();$this->getIncrementId();不返回任何內容。

如果我使用$order->getOrder();或者$order->getOrderId();或者$order->getIncrementId();返回一個錯誤:

Fatal error: Call to a member function getIncrementId() on a non-object

我缺少什麼?

+0

無論'$ order'是在你的情況下,它是不是一個對象,因此不能有一個成員函數'getOrder()'等,這就是爲什麼你得到錯誤。 – Striezel

+0

但'$ this-> getOrder();'應該可以,不是嗎? – Rodolfo

+0

你是怎麼使用info.phtml的,什麼是塊類? –

回答

-1

請詳細說明一下。我的意思是你可以發佈功能。嘗試一下。

$order = Mage::getModel('sales/order'); $order->load(Mage::getSingleton('sales/order')->getLastOrderId()); $lastOrderId = $order->getIncrementId();

+0

這個函數'$ this-> getOrder();'不會導致錯誤,但不會返回任何信息。 – Rodolfo

0

嘗試下面的代碼,希望這會有所幫助。

$this->getOrder()->getRealOrderId() 
0

請嘗試下面的代碼。

代碼位於應用程序\設計\前臺\基地\ DEFAULT \模板\銷售\命令\ info.phtml

$_order = $this->getOrder(); 
echo $_order->getRealOrderId(); 
相關問題