Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

Fatal error: Cannot redeclare class TCPDF
(1 viewing) (1) Guest
Support forum for customers who have purchased this product. Archive only, no new post can be added.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.
  • Page:
  • 1

TOPIC: Fatal error: Cannot redeclare class TCPDF

Fatal error: Cannot redeclare class TCPDF 13 years, 2 months ago #24242

I went ahead and took a chance last night and purchased VM Invoice. It looks like a great component but I can not get it to work. Admittedly, I am not a coder so I do not know how to fix my problem. When clicking on the save button when manually creating a new invoice as a phone order, I get the following error message:

Fatal error: Cannot redeclare class TCPDF in /xxx/xxxx/xxx/administrator/components/com_vminvoice/tcpdf/tcpdf.php on line 152

How can I fix this. BTW, I xxx out my site info for security reasons.
The topic has been locked.

Re: Fatal error: Cannot redeclare class TCPDF 13 years, 2 months ago #24261

  • jaku
Hello,

as the error message claims, the reason for it is that the class TCPDF (that is responsible for the PDF generation) is already defined. Probably this is done by some other component or module/plugin that runs before VM Invoice.

A hotfix for this would be editing the file administrator/com_vminvoice/helpers/invoicepdf.php.
and wrapping the lines:
require_once (dirname(__FILE__) . '/../tcpdf/tcpdf.php');
require_once (dirname(__FILE__) . '/../tcpdf/config/tcpdf_config.php');

with a condition:
if (!class_exists('TCPDF')) {
require_once (dirname(__FILE__) . '/../tcpdf/tcpdf.php');
require_once (dirname(__FILE__) . '/../tcpdf/config/tcpdf_config.php');
}

Just please note, that the TCPDF library that is loaded at that time MAY be different version that is compatible with VM Invoice. In such case, it would be neccessary to identify, where in your site's code it is preloaded and prevent it.
Last Edit: 13 years, 2 months ago by .
The topic has been locked.

Re: Fatal error: Cannot redeclare class TCPDF 13 years, 2 months ago #24287

Thanks, Jan. I will give this a try and report back. I did a little digging and TCPDF is also used by ccVAOM on my site which, btw, if you guys could add a feature to allow me to select and download numerous invoices at one time, I would ditch ccVAOM and I spent a lot more on it than on VM Invoice!
The topic has been locked.

Re: Fatal error: Cannot redeclare class TCPDF 13 years, 2 months ago #24288

Just made the changes and it worked like a charm! Thanks!
The topic has been locked.

Re: Fatal error: Cannot redeclare class TCPDF 13 years, 2 months ago #24314

  • jaku
Ok, glad to hear that.
As regards the possibility of downloading multiple invoices, we will add it to hour TODO list.
The topic has been locked.
  • Page:
  • 1
User Login Empty