我想在发票上通过 magento 的后端打印发票,但在我打开错误后它给了我这个错误index.php
致命错误:在第 119 行对 app/code/core/Mage/Adminhtml/Controller/Sales/Ininvoice 中的非对象调用成员函数 getPdf(.php
public function printAction()
{
if ($invoiceId = $this->getRequest()->getParam('invoice_id')) {
if ($invoice = Mage::getModel('sales/order_invoice')->load($invoiceId)) {
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($invoice));
$this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
'.pdf', $pdf->render(), 'application/pdf');
}
}
else {
$this->_forward('noRoute');
}
}
错误指出此行:
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($invoice));
包含一个错误,但我没有看到任何问题,我也不明白为什么它会在核心文件夹 php 文件上出错。我也没有以任何方式修改它。
首先,告诉你使用的是哪个版本的Magento?
同时,您可以尝试以下方法:
- 禁用所有已安装的扩展,并在逐个启用它们时,找出触发问题的模块;
- 清除缓存。
Magento使用旧的Zend PDF库,该库存在一个问题:
http://framework.zend.com/issues/browse/ZF-12093
只是评论
//abstract public function __construct();
//abstract public function __destruct();
在
app''code''local''Zend''Pdf''FileParserDataSource.php.