Print invoice button gives blank page with error - php

I want to print the invoice through the back-end of magento at invoices but it gives me this error after I turned on the errors in index.php
Fatal error: Call to a member function getPdf() on a non-object in app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php on line 119
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');
}
}
The error says that this line:
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($invoice));
contains an error but I don't see any problem also I don't get it why it gives error on a core folder php file. I haven't modify it in any way too.

First, tell which version of Magento you are using?
Meanwhile, you may try the following:
disable all the installed extensions, and when enabling them one by one, figure out which module is triggering the issue;
clear cache.

Magento uses old Zend PDF library which has an issue:
http://framework.zend.com/issues/browse/ZF-12093
Just comment
//abstract public function __construct();
//abstract public function __destruct();
in
app\code\local\Zend\Pdf\FileParserDataSource.php.

Related

Blank screen when attempting to view an order after magento upgrade 1.9.1

I've got this error after moving from magento 1.7 to magento 1.9.1.
In the beginning, it was a blank page. I enabled display error and I got this:
Fatal error: Undefined class constant 'ACTION_FLAG_PRODUCTS_PERMISSION_DENIED' in /var/www/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php on line 119
Code:
public function viewAction()
{
$this->_title($this->__('Sales'))->_title($this->__('Orders'));
$order = $this->_initOrder();
if ($order) {
$isActionsNotPermitted = $order->getActionFlag(
Mage_Sales_Model_Order::ACTION_FLAG_PRODUCTS_PERMISSION_DENIED
);
if ($isActionsNotPermitted) {
$this->_getSession()->addError($this->__('You don\'t have permissions to manage this order because of one or more products are not permitted for your website.'));
}
$this->_initAction();
$this->_title(sprintf("#%s", $order->getRealOrderId()));
$this->renderLayout();
}
}
I am using php 5.3. I changed the folders permissions, but it didn't work as per other suggestions.
Before the line:
$this->renderLayout();
You should load the layout using the following function call:
$this->loadLayout();

Codeigniter: PHP error on all pages

I have been working on a site using codeigniter. On localhost, everything works well but when I uploaded it online, all its pages got a php error below the footer. The error is as shown below:
A PHP Error was encountered
Severity: Warning
Message: Unknown: failed to open stream: No such file or directory
Filename: Unknown
Line Number: 0
The Controller
class Home extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper(array('form','url'));
$this->load->library(array('session'));
$this->load->database();
$this->load->model('property_model');
}
public function index()
{
$data['title'] = "iRent-Home";
$this->load->view('home',$data);
}
}
I thought the error might be caused by the header or footer views since they are loaded on each page. I have counter checked the code in those two views and they look okay. I think it might also be a permissions issue, tried giving several files permission but it didn't work. Anyone with an idea what the problem is?
kindly read the documentation on errors https://ellislab.com/codeigniter/user-guide/general/errors.html and review your code

Omtex mobile version account/login error

I installed omtex extension on my website but when I try to access account or try to register it brings a fatal error:
call to a member function modcheck() on a non object in vqmod/vqcache/vq2-system_engine_controller.php line 91
Here is the code:
// LINE 80 HERE BELOW
ob_start();
require(VQMod::modCheck(VQMod::modCheck(DIR_TEMPLATE . $this->template)));
$this->output = ob_get_contents();
ob_end_clean();
return $this->output;
} else {
// LINE 91 HERE BELOW
$file_default = $vqmod->modCheck(DIR_DEFAULT_TEMPLATE . $this->template);
if (file_exists($file_default)) {
extract($this->data);
ob_start();
require(VQMod::modCheck(VQMod::modCheck($file_default)));
$this->output = ob_get_contents();
ob_end_clean();
return $this->output;
}
You're calling it statically here:
require(VQMod::modCheck(VQMod::modCheck(DIR_TEMPLATE . $this->template)));
^^^^^^^^^^^^^^^---
and various other places, but as a method here:
$file_default = $vqmod->modCheck(DIR_DEFAULT_TEMPLATE . $this->template);
and in a couple places. is $vqmod an object? Your error suggests it's not.
The latest version of vQmod is not instance based - it's static. This change occurred over a year ago, and as such the code above should be upgraded. Simply changing $vqmod->modCheck to VQMod::modCheck will solve this issue. Also, if there is a global $vqmod; somewhere before the outdated code, remove it. You should also check your installation, as there should not be two calls to VQMod::modCheck in the requires. Either you've got two XML files doing the same thing, or you've hard coded the modCheck for whatever reason

Fatal error: Call to a member function load() on a non-object Joomla

I have Joomla! 1.7.2 Stable and when I try to Log in to administration area I get this error
Fatal error: Call to a member function load() on a non-object in /home/shomos1/public_html/portal/libraries/joomla/user/user.php on line 822
this is the error line in my user.php
public function load($id)
{
// Create the user table object
$table = $this->getTable();
var_dump($table);
// Load the JUserModel object based on the user id or throw a warning.
if (!$table->load($id)) {
JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('JLIB_USER_ERROR_UNABLE_TO_LOAD_USER', $id));
return false;
}
// Set the user parameters using the default XML file. We might want to
// extend this in the future to allow for the ability to have custom
// user parameters, but for right now we'll leave it how it is.
$this->_params->loadString($table->params);
// Assuming all is well at this point lets bind the data
$this->setProperties($table->getProperties());
return true;
}
}
I am not good in Joomla and I can't understand what is the problem there
please need help what can I do to solve this problem
Thanks
the default com_user component is conflicting with your component so you must rename your component files they must not have name "user" ...

Magento: what did I break? "Fatal error: Call to a member function insert()" (version 1.4.1.1)

I was trying to implement some new functionality, decided not to, tried to roll back, and now am stuck with this error:
Fatal error: Call to a member function insert() on a non-object in /app/code/core/Mage/Core/Model/Mysql4/Resource.php on line 96
The functionality I mentioned seems simple enough (remove a couple links from the customer account sidebar), and I believe I've removed the 3 files and the edit to local.xml, but just for full view on things, here's exactly what i did.
Add'l info: I've got one custom module in place that I built for this site, and it was working prior to this glitch, but I'm wondering if something got screwed up in there maybe? (And I'm also thinking I might not have committed my last/working change, and now I'm in "doubt" territory about whether I screwed that up. It's a simple one though: 1 controller, 1 route.)
I've got no access to PHP error logs or the shell (exec() works great though), and the /var/system.log isn't adding anything more on my subsequent page-refreshes. And so this is where I'm stuck - Got any ideas on how to track this down? Thanks in advance!
Edit / here's the function that's throwing the error:
function setDbVersion($resName, $version)
{
$dbModuleInfo = array(
'code' => $resName,
'version' => $version,
);
if ($this->getDbVersion($resName)) {
self::$_versions[$resName] = $version;
$condition = $this->_write->quoteInto('code=?', $resName);
return $this->_write->update($this->_resTable, $dbModuleInfo, $condition);
}
else {
self::$_versions[$resName] = $version;
// this is line 96:
return $this->_write->insert($this->_resTable, $dbModuleInfo);
}
}

Categories