【发布时间】:2014-03-29 03:35:03
【问题描述】:
我已加载新订单交易电子邮件以插入自定义块。我将它插入到订单项目表布局句柄调用下,并尝试将其传递给$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 email templates,但我仍然遇到这个致命错误。
有什么想法吗?
【问题讨论】:
标签: magento email block transactional-email