Jump to content
chris23

[CONTRIBUTION] PDF Customer Invoice

Recommended Posts

Greetings,

 

I have installed this great contribution on an oscommerce 2.2rc2a and all the add-ons works perfectly EXCEPT the pdfpackingslip.php wich renders me only a completly BLANK PAGE.

 

Does this happens to someone else or does someone knows why does this happens?

 

Best regards,

Luis Xavier

Share this post


Link to post
Share on other sites

@@BlueBunyip

Hi

 

Just thought Id give this a go.

All good with the exception that the company details on the top right of the PDF invoice don't appear, however the Company name does, The email address does but no "E-mail" text in front of the email address ( if that makes sense)

 

Look forward to your thoughts.

 

Cheers

Grandpa

Share this post


Link to post
Share on other sites

Well, looks like this contribution is totally unsupported by the original writers!

I'm on V1.5, works well BUT a few errors about depreciated functions. (magic quotes which is to be removed completely and split() which can be re-written using preg_split)

This needs to be updated.

Share this post


Link to post
Share on other sites

@@BlueBunyip

Hi

 

Just thought Id give this a go.

All good with the exception that the company details on the top right of the PDF invoice don't appear, however the Company name does, The email address does but no "E-mail" text in front of the email address ( if that makes sense)

 

Look forward to your thoughts.

 

Cheers

Grandpa

 

 

Hi Grandpa,

 

sorry for the late reply - I must have been asleep and missed your post. The company details are commented out around line 235 of pdfinvoice.pdf - uncommenting it should make it display. "Email" needs defining in the language file - I had it blanked out as I wanted a cleaner form and the word "Email" seemed a little redundant these days. Currently it reads "define ('PDF_INV_EMAIL',''); " so  "define ('PDF_INV_EMAIL','Email:'); " should do what you want.

 

Greg

Share this post


Link to post
Share on other sites
Hello,

 

First of all, thanks a lot for your contribution.

 

I am installing PDF Customer Invoice v1.0 (PDF Invoice 1.6 for 2.3.4 EDGE) addon in 2.3.1 oscommerce and I am having some issues.

 

1) Invoice´s Final Total Price shows some of the last numbers of the price on the next line,  so the total price appears cutted. 

Is there some way to resize the width for the products table and the final Invoice summary? 

 

2) Text does not fit well on Invoice to and Deliver boxes so I would like to add space to one additional text line. Is there some way to resize the hight and width for these boxes? 

 

3) My Catalog.includes.classes.order.php file does not have the code lines mentioned in the installing instructions so I am unable to display the order comments on the invoice PDF. 

 

Please I will thank a lot any help.   

Share this post


Link to post
Share on other sites

 

Hello,
 
First of all, thanks a lot for your contribution.
 
I am installing PDF Customer Invoice v1.0 (PDF Invoice 1.6 for 2.3.4 EDGE) addon in 2.3.1 oscommerce and I am having some issues.
 
1) Invoice´s Final Total Price shows some of the last numbers of the price on the next line,  so the total price appears cutted. 
Is there some way to resize the width for the products table and the final Invoice summary? 
 
2) Text does not fit well on Invoice to and Deliver boxes so I would like to add space to one additional text line. Is there some way to resize the hight and width for these boxes? 
 
3) My Catalog.includes.classes.order.php file does not have the code lines mentioned in the installing instructions so I am unable to display the order comments on the invoice PDF. 
 
Please I will thank a lot any help.   

 

I already found solution for questions 1 and 2.

 

Please somebody who can help me with number 3 question.

 

Thanks in advanced.

Edited by elara

Share this post


Link to post
Share on other sites

@@elara

 


I am installing PDF Customer Invoice v1.0 (PDF Invoice 1.6 for 2.3.4 EDGE) addon in 2.3.1 oscommerce and I am having some issues.
 
 
 
3) My Catalog.includes.classes.order.php file does not have the code lines mentioned in the installing instructions so I am unable to display the order comments on the invoice PDF.

 

The addon your are trying to install is for osC 2.3.4 EDGE. You are trying to install it on a much older version of osC (2.3.1).

 

You can try downloading the 2.3.4 EDGE version, and see what is different in catalog/includes/classes/order.php from the EDGE version and the version you have in osC 2.3.1.

 

HTH

 

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

@@elara

 

 

The addon your are trying to install is for osC 2.3.4 EDGE. You are trying to install it on a much older version of osC (2.3.1).

 

You can try downloading the 2.3.4 EDGE version, and see what is different in catalog/includes/classes/order.php from the EDGE version and the version you have in osC 2.3.1.

 

HTH

 

Malcolm

Thanks a lot Malcolm, by now I am unable to upgrade my 2.3.1 OSC due I have a LOT of addons and modifications working on this old version. 
 
Some idea about how to do to PDF Customer Invoice (comments) works on 2.3.1?
 
Thanks in advanced.

Share this post


Link to post
Share on other sites

@@elara

 

Perhaps I wasn't clear. What I tried to say was:

 

1) download the latest EDGE version,

2) examine the catalog/includes/classes/order.php file from the EDGE version,

3) compare it to the catalog/includes/classes/order.php file in your 2.3.1 version,

4) note the differences, and

5) apply the differences to the catalog/includes/classes/order.php file in your 2.3.1 version

 

You are trying this all on a backup of your site, and not the live site, right?

 

HTH

 

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

i am using PDF Customer Invoice 1.6 for 2.3.4 EDGE with OsCommerce 2.3.4BS and would like to update the fpdf class from 1.6 to 1.8.1

has somebody been successful updating fpdf from 1.6 to 1.8.1 ?

currently i get this error using fpdf 1.8.1

Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file' in /var/www/vhosts/shopname/httpdocs/includes/modules/fpdf/fpdf.php:271 Stack trace: #0 /var/www/vhosts/shopname/httpdocs/includes/modules/fpdf/fpdf.php(1085): FPDF->Error('Some data has a...') #1 /var/www/vhosts/shopname/httpdocs/includes/modules/fpdf/fpdf.php(1013): FPDF->_checkoutput() #2 /var/www/vhosts/shopname/httpdocs/pdfinvoice.php(899): FPDF->Output('D', 'shopname_in...', true) #3 {main} thrown in /var/www/vhosts/shopname/httpdocs/includes/modules/fpdf/fpdf.php on line 271

Edited by Stephan Gebbers

 

 

Share this post


Link to post
Share on other sites

found a solution thanks to the search enginges :)

adding
ob_end_clean();     

right before the Output
$pdf->Output($file_name, $mode, TRUE);

solved the problem for me! 


 

 

Share this post


Link to post
Share on other sites

Have just installed PDF Customer Invoice 1.6 for 2.3.4 EDGE, but the link to the invoice just generates a blank page with no error messages? Have installed quite a few add-ons on the past, so certainly not some newbie error :-)

The link opens a new blank web page with URL ending /pdfinvoice.php?order_id=26824

Could this be an FPDF issue? Any ideas please

Share this post


Link to post
Share on other sites

Hello Vin @realvinner,

You should first check if there is any php error registered in you error.log. A blank page means that the script has been stopped to be interpreted and this ist most common due to a fatal php error.

Then post the error message here and we'll be able to give you more concrete advice.

 

rgds

Rainer

Share this post


Link to post
Share on other sites
On 12/16/2017 at 4:32 AM, realvinner said:

Have just installed PDF Customer Invoice 1.6 for 2.3.4 EDGE, but the link to the invoice just generates a blank page with no error messages? Have installed quite a few add-ons on the past, so certainly not some newbie error :-)

The link opens a new blank web page with URL ending /pdfinvoice.php?order_id=26824

Could this be an FPDF issue? Any ideas please

Weird, I have the same problem.

No errors in the error_log.

The only thing I could grab was in the Firefox debugger:

Could not load the source for blob:http://testosc.mysite.com/0e7b9518-1cf4-41a6-9b77-ea40d76ece47.
[Exception... "Failed to open input source 'file:////testosc.mysite.com/0e7b9518-1cf4-41a6-9b77-ea40d76ece47'"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)"  location: "JS frame :: resource://devtools/shared/base-loader.js -> resource://devtools/shared/DevToolsUtils.js :: mainThreadFetch :: line 547"  data: yes]
Stack: mainThreadFetch@resource://devtools/shared/base-loader.js -> resource://devtools/shared/DevToolsUtils.js:547:5
_getSourceText/<@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/source.js:404:27
process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:922:23
walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:806:7
scheduleWalkerLoop/<@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:742:11
Line: 547, column: 0

Share this post


Link to post
Share on other sites

Not sure, but the files may still have directory constants in use which have been removed in latest 2.3.4 EDGE. Search for example for DIR_WS_INCLUDES and replace by hardcoded path 'includes/'. there are more of them, search for any term beginning with DIR_WS_ and replace with the correct hardcoded paths.

Or use the compatibility add-on:

https://apps.oscommerce.com/RNywS&add-on-compatibility-for-2-3-4-edge

Share this post


Link to post
Share on other sites
9 hours ago, raiwa said:

Not sure, but the files may still have directory constants in use which have been removed in latest 2.3.4 EDGE. Search for example for DIR_WS_INCLUDES and replace by hardcoded path 'includes/'. there are more of them, search for any term beginning with DIR_WS_ and replace with the correct hardcoded paths.

Or use the compatibility add-on:

https://apps.oscommerce.com/RNywS&add-on-compatibility-for-2-3-4-edge

All of that has been taken care of.

This even works on my localhost installation.  It doesn't work only when transferred out to my server....

Share this post


Link to post
Share on other sites

Just did some check in my develop store version for PHP 7.1 and found the following issue:

in fpdf/fpdf.php line 402-407:

	// Set color for all filling operations
	if(($r==0 && $g==0 && $b==0) || $g===null)
		$this->FillColor = sprintf('%.3F g',$r/255);
	else
		$this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);

produces the error message:

A non-numeric value encountered in .....line 405

If I comment out these lines the file renders correct, obviously with some black background in the table header.

So it seems we have to find a PHP 7.1 compatible replacement code. The same code was working correct under PHP 5.6.

Share this post


Link to post
Share on other sites

For me this fix does it:

$r needs to be defined with a default numeric value:

	// Set color for all filling operations
	$r = 255;
	if(($r==0 && $g==0 && $b==0) || $g===null) {
		$this->FillColor = sprintf('%.3F g',$r/255);
}	else {
		$this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
}

 

Share this post


Link to post
Share on other sites

The reason you didn't get the error logged is that you may have set warning messages not to be logged, but in that case it prevents the file to be rendered => blank page. For debugging you should consider to set error reporting to "all". And displaying error messages is faster than to check the error log. For a develop/test environment this shouldn't be a problem I guess.

Share this post


Link to post
Share on other sites
34 minutes ago, raiwa said:

The reason you didn't get the error logged is that you may have set warning messages not to be logged, but in that case it prevents the file to be rendered => blank page. For debugging you should consider to set error reporting to "all". And displaying error messages is faster than to check the error log. For a develop/test environment this shouldn't be a problem I guess.

Interesting, let me take a look.

Where is the best place to turn error reporting to "all" ?

Thanks Raiwa!

Share this post


Link to post
Share on other sites

in application_top.php:

// set the level of error reporting
//  error_reporting(E_ALL & ~E_NOTICE);
  error_reporting(E_ALL);

//  if (defined('E_DEPRECATED')) {
//    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
//  }

This  settings may be overwritten by settings in your servers CPanel or php.ini.

Share this post


Link to post
Share on other sites
1 hour ago, raiwa said:

in application_top.php:


// set the level of error reporting
//  error_reporting(E_ALL & ~E_NOTICE);
  error_reporting(E_ALL);

//  if (defined('E_DEPRECATED')) {
//    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
//  }

This  settings may be overwritten by settings in your servers CPanel or php.ini.

Thank you.  I found a bunch of little things turning that on... but still haven't resolved the problem.

Something is different between my server settings and my localhost WAMP settings.   I'm trying to figure out what.

It works perfectly on localhost, just not on my real server. 

No more warnings are being reported - just a blank screen.  Also I never see the fpdf error you reference above which is odd.  I don't think mine has that issue.  Thanks for the help thus far

Share this post


Link to post
Share on other sites

I have this installed on 2.3.4 edge and am having issues with the below error

 

Quote

Warning: Use of undefined constant STORE_NAME_ADDRESS - assumed 'STORE_NAME_ADDRESS' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\oscomm\pdfinvoice.php on line 236
FPDF error: Some data has already been output, can't send PDF file

If I comment out line 236 the pdf loads but doesn't show the store address.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×