我已經加載了新訂單交易電子郵件以插入自定義塊。我在訂單項目表格下面插入了句柄調用,並嘗試通過它$order
變量。無法從交易電子郵件模板的塊指令中傳遞變量
{{layout handle="sales_email_order_items" order=$order}}
...
{{block type="mymodule/sales_order_email_description" order=$order}}
在Mymodule_Block_Sales_Order_Email_Description I類寫道:
protected function _construct() {
$this->setTemplate('email/order/description.phtml');
}
最後在description.phtml我嘗試訪問順序:
$order = $this->getOrder();
...
$order->getId()
此時,異常上升: Fatal error: Call to a member function getId() on a non-object ... ...
我跟隨severa l教程,像這樣magento email templates,但我仍然堅持這個致命的錯誤。
任何想法?