我已加载新订单交易电子邮件以插入自定义块。我将它插入到订单项表布局句柄调用下,并尝试将其传递给$order
变量。
{{layout handle="sales_email_order_items" order=$order}}
...
{{block type="mymodule/sales_order_email_description" order=$order}}
在 Mymodule_Block_Sales_Order_Email_Description 类中我写道:
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 ... ...
我遵循了几个教程,比如这个magento 电子邮件模板,但我仍然遇到这个致命错误。
有任何想法吗?