打印发票按钮显示空白页面有错误

时间:2014-12-10 10:08:08

标签: php magento

我想在发票上通过magento的后端打印发票,但是在我打开index.php

中的错误后我发现了这个错误
  

致命错误:在第119行的app / code / core / Mage / Adminhtml / Controller / Sales / Invoice.php中的非对象上调用成员函数getPdf()

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文件上出错。我也没有以任何方式修改它。

2 个答案:

答案 0 :(得分:0)

首先,告诉您正在使用哪个版本的Magento?

同时,您可以尝试以下方法:

  • 禁用所有已安装的扩展,并在逐个启用它们时,找出触发问题的模块;
  • 清除缓存。

答案 1 :(得分:0)

Magento使用旧的Zend PDF库存在问题:

http://framework.zend.com/issues/browse/ZF-12093

只需评论

//abstract public function __construct();
//abstract public function __destruct();

in

应用\代码\本地\ Zend的\全文\ FileParserDataSource.php。

相关问题