GemRock 7 Posted August 2, 2008 If what you want is nothing more than print/save invoices from admin, and do not want to make lots of changes to your shop, especially database changes, to achieve this little tiny thing, then this is the contribution for you. Here is the installation instruction (if you need it) that is not included in the package: commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
GemRock 7 Posted August 2, 2008 (edited) Sorry I was locked out while I was entering the text. Here it is: If what you want is nothing more than print/save invoices from admin, and do not want to make lots of changes to your shop, especially database changes, to achieve this little tiny thing, then this is the contribution for you: pdf invoices for admin only It is basically taken from chris23's pdf invoice controbution but modified it so that there is no need to make any changes at the shop front epspecially the checkout process, and there is no database changes. All credits to chris23 and those mentioned by chris23. chris23's addon does have admin access but that requires you to do a full installation, which I do not think it is necessary. Here is the installation instruction (if you need it) that is not included in the package: 1. copy all the files to the admin side of your shop, observing the folder structure in the downloaded package. I do not expect you have the same file names on your shop, so it'd be safe to just upload them to your shop; 2. open [admin]/orders.php for edit, look for the line: $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); it should be near the end of the file. 3. before it, insert: $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('invoice_pdf.php', 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice_pdf.gif', 'generate pdf invoice for this order') . '</a>'); That's all. I do not expect there would be support issues posted here but as standard I created this support thread. Edited August 2, 2008 by GemRock commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
GemRock 7 Posted August 2, 2008 One final thing to mention: Open [admin]/invoice_pdf.php, edit lines 15 to 25 for your shop and your taste (font & colour). Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
Gary-London 0 Posted August 2, 2008 (edited) Code correction... $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('invoice_pdf.php', 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice_pdf.gif', 'generate pdf invoice for this order') . '</a>'); Other than this it works perfectly and will save me some time! Edited August 2, 2008 by Gary-London Gazza If its not broken...why try fixing it?? Share this post Link to post Share on other sites
GemRock 7 Posted August 2, 2008 (edited) Thanks Gary_london for pointing out the error. as I mentioned above I was locked outalthough what i typed was saved automatically which was good but i did not realise it was being too good to change the code for me with what it thought was right. Now you should look for this line of code: $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); and insert before it: $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('invoice_pdf.php', 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice_pdf.gif', 'generate pdf invoice') . '</a>'); Ken Edited August 2, 2008 by GemRock commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
Coopco 8 Posted August 3, 2008 Thanks Gary_london for pointing out the error. as I mentioned above I was locked outalthough what i typed was saved automatically which was good but i did not realise it was being too good to change the code for me with what it thought was right. Now you should look for this line of code: $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); and insert before it: $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('invoice_pdf.php', 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice_pdf.gif', 'generate pdf invoice') . '</a>'); Ken Hi Ken The languages folder is spelt incorrectly, otherwise, works very well. I do need to add some blank lines at the bottom of the payment box, and to add some blank lines between the subtotal and total. Do you know how this can be done? The Coopco Underwear Shop If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left. Share this post Link to post Share on other sites
GemRock 7 Posted August 3, 2008 Hi coopco line 419: // $pdf->Text(10,117, tep_html_entity_decode(PDF_INV_CUSTOMER_REF) . (int)$customer_id); i suppose you could un-done the comment and then chnage tep_html_entity_decode(PDF_INV_CUSTOMER_REF) . (int)$customer_id); to '' lines 509 - 521 are for the totals. I suppose you need to do a if test to see if it is the line after which you like to add a blank line, if it is then simply increase the value of the variable $Y_Table_Position to, say, 10. I have not tried it myself as I cant see why there would be such a need... Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
Coopco 8 Posted August 3, 2008 (edited) Hi coopco line 419: // $pdf->Text(10,117, tep_html_entity_decode(PDF_INV_CUSTOMER_REF) . (int)$customer_id); i suppose you could un-done the comment and then chnage tep_html_entity_decode(PDF_INV_CUSTOMER_REF) . (int)$customer_id); to '' lines 509 - 521 are for the totals. I suppose you need to do a if test to see if it is the line after which you like to add a blank line, if it is then simply increase the value of the variable $Y_Table_Position to, say, 10. I have not tried it myself as I cant see why there would be such a need... Ken Hi Ken Thanks for the info. I used for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { $pdf->SetY($Y_Table_Position + 10); $pdf->SetX(102); $temp = substr ($order->totals[$i]['text'],0 ,3); if ($temp == '<b>') { $pdf->SetFont(PDF_INV_CORE_FONT,'B',10); $temp2 = substr($order->totals[$i]['text'], 3); $order->totals[$i]['text'] = substr($temp2, 0, strlen($temp2)-4); } $pdf->MultiCell(94,6,$order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'],0,'R'); $Y_Table_Position += 20; This does the job that I want (at least it is presentable). My shipping info and shipping cost takes 3 lines. Now to get it working with improved order number. Edited August 3, 2008 by Coopco The Coopco Underwear Shop If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left. Share this post Link to post Share on other sites
Gary-London 0 Posted August 11, 2008 Getting a strange error message... FPDF error: Alpha channel not supported: images/oscommerce.png I have replaced the 'oscommerce.png' file with the store logo, but left the file name the same, so in theory it would just display the logo instead of the oscommerce logo. Any one had the same error? or a way around? Cheeeeeeeeeers! Gary Gazza If its not broken...why try fixing it?? Share this post Link to post Share on other sites
GemRock 7 Posted August 11, 2008 Getting a strange error message... FPDF error: Alpha channel not supported: images/oscommerce.png... well, you dont have to use a png image but if you do then as the error suggests make sure you dont have Alpha channel in it since it is not supported. do you a favour to use a gif or jpg image. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
Gary-London 0 Posted August 11, 2008 well, you dont have to use a png image but if you do then as the error suggests make sure you dont have Alpha channel in it since it is not supported.do you a favour to use a gif or jpg image. Ken Ken, Where abouts in the code do I change the file extension? i.e from '.png' to '.gif'? Thanks, Gary Gazza If its not broken...why try fixing it?? Share this post Link to post Share on other sites
GemRock 7 Posted August 11, 2008 (edited) Ken, Where abouts in the code do I change the file extension? i.e from '.png' to '.gif'? Thanks, Gary see my post above (post number 3) - the invoice_pdf.php under the admin folder - you wont miss it. Ken Edited August 11, 2008 by GemRock commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
robguay 0 Posted August 26, 2008 Love the contribution. One request: Is there a way to remove the following fields [Price | Price (inc) | Total | Total (inc)]. Share this post Link to post Share on other sites
mistershop 0 Posted September 3, 2008 Thank you for the excellent contributions, could you please explain how to define the image dimensions as it gets stretched and looks pixelated? Thanks! MS Share this post Link to post Share on other sites
tfoolen 0 Posted September 12, 2008 Great contrib, but I can't seem to get it to work in my live environment. Maybe it has something to do with my config file. Keep getting this error: Warning: FPDF::include(/httpdocs/admin/fpdf/font/helveticabi.php) [function.FPDF-include]: failed to open stream: No such file or directory in /httpdocs/admin/includes/classes/fpdf.php on line 550 Warning: FPDF::include() [function.include]: Failed opening '/httpdocs/admin/fpdf/font/helveticabi.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /httpdocs/admin/includes/classes/fpdf.php on line 550 FPDF error: Could not include font metric file Checked and double checked: all the necessary files are in place. Also tried to change the path in the classes/fpdf.php file into the absolute path to admin/fpdf/font/... but that is no solution either. Then it keeps expecting a { or $, at least: that is what the new error is saying. Suggestions anyone? Share this post Link to post Share on other sites
GemRock 7 Posted September 13, 2008 (edited) Great contrib, but I can't seem to get it to work in my live environment. Maybe it has something to do with my config file... yes indeed it may have something to do with your config file. on about line 14 in invoice_pdf.php, take a look at this line: define('FPDF_FONTPATH', DIR_FS_ADMIN . 'fpdf/font/'); the key here is DIR_FS_ADMIN. check your configure.php to see what its value is. or do an echo right afer the above line to see what it is: echo DIR_FS_ADMIN; and/or echo FPDF_FONTPATH; then compare with that in the error msg. Ken ps. i am sorry but i do not monitor this support thread closely and i am afraid i dont have the free time to offer further modification to the invoice to suit each individual store as there would be too many which may have different ideas of how their invoices would look etc..i can only answer some general questions RE installation. Edited September 13, 2008 by GemRock commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
tfoolen 0 Posted September 13, 2008 yes indeed it may have something to do with your config file. on about line 14 in invoice_pdf.php, take a look at this line:define('FPDF_FONTPATH', DIR_FS_ADMIN . 'fpdf/font/'); the key here is DIR_FS_ADMIN. check your configure.php to see what its value is. or do an echo right afer the above line to see what it is: echo DIR_FS_ADMIN; and/or echo FPDF_FONTPATH; then compare with that in the error msg. Ken ps. i am sorry but i do not monitor this support thread closely and i am afraid i dont have the free time to offer further modification to the invoice to suit each individual store as there would be too many which may have different ideas of how their invoices would look etc..i can only answer some general questions RE installation. Fixed, thanks a lot. That was the line I was looking for. Now it really is a great contrib ;-) Share this post Link to post Share on other sites
GemRock 7 Posted October 1, 2008 I would like to make it clear (again) that I can only answer questions RE installation of this contribution but my support will have to stop there as I do not have the free time to offer help with regard to the further modification of the pdf invoice to suit individual needs, which would be far too many. So please do not pm or email me asking questions RE modification or any other issues, unless you want to pay. I am sorry but I dont even have the time to reply to any pm/email, so dont waste your time waiting. Good Luck, Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
SouthsideCigar 0 Posted October 10, 2008 I am getting the following error when I try to generate the PDF FPDF error: Some data has already been output, can't send PDF file Does anyone have a suggestion? Dave Share this post Link to post Share on other sites
GemRock 7 Posted October 13, 2008 my suggestion is: 1. check to make sure you dont have any blank line(s) at the very beginning (before the opening <?php) in any of the files involved; 2. since the error is the positive result of a test of the ob_get_contents function, (which gives a hint of the problem as mentioned in 1), you could try to add an ob_clean before the ob_get_contents line for debug purpose in fpdf.php. I cant not re-produce the error, or I dont feel like I should to find the time to try to, therefore I cant offer a specific solution. Good luck, Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
kblocksom 0 Posted November 9, 2008 (edited) Sorry I was locked out while I was entering the text. Here it is: If what you want is nothing more than print/save invoices from admin, and do not want to make lots of changes to your shop, especially database changes, to achieve this little tiny thing, then this is the contribution for you: pdf invoices for admin only It is basically taken from chris23's pdf invoice controbution but modified it so that there is no need to make any changes at the shop front epspecially the checkout process, and there is no database changes. All credits to chris23 and those mentioned by chris23. chris23's addon does have admin access but that requires you to do a full installation, which I do not think it is necessary. Here is the installation instruction (if you need it) that is not included in the package: 1. copy all the files to the admin side of your shop, observing the folder structure in the downloaded package. I do not expect you have the same file names on your shop, so it'd be safe to just upload them to your shop; 2. open [admin]/orders.php for edit, look for the line: $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); it should be near the end of the file. 3. before it, insert: $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('invoice_pdf.php', 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice_pdf.gif', 'generate pdf invoice for this order') . '</a>'); That's all. I do not expect there would be support issues posted here but as standard I created this support thread. Could you please check this line of code that you wrote. I added this to and it continues to give me a syntax error. Thanks Edited November 9, 2008 by kblocksom Share this post Link to post Share on other sites
kblocksom 0 Posted November 10, 2008 Ken I was able to get the code straight on the above problem, but now when I go into ADMIN and attempt to print the PDF out in the invoice area it gives me this error: Warning: getimagesize(images/oscommerce.gif) [function.getimagesize]: failed to open stream: No such file or directory in E:\inetpub\vhosts\southern-delights.com\httpdocs\admin\invoice_pdf.php on line 103 Warning: getimagesize(images/oscommerce.gif) [function.getimagesize]: failed to open stream: No such file or directory in E:\inetpub\vhosts\southern-delights.com\httpdocs\admin\includes\classes\fpdf.php on line 900 FPDF error: Unsupported image type: gif Any ideas? Thanks Share this post Link to post Share on other sites
GemRock 7 Posted November 10, 2008 Check your server has GD enabled for your site. if not, ask for it from your host, or find another decent host that does. the GD library/functions should be available by default on a decent server. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites
kblocksom 0 Posted November 10, 2008 Check your server has GD enabled for your site. if not, ask for it from your host, or find another decent host that does. the GD library/functions should be available by default on a decent server. Ken Thanks for your quick response. Where can I find if GD has been enabled? And what exactly does GD stand for? Share this post Link to post Share on other sites
GemRock 7 Posted November 10, 2008 (edited) sorry I might have read your post too quick. in fact the problem/error is the oscommerce.gif is missing so make sure you have the image (oscommerce.gif) at /admin/images/. or change that image name and/or folder on line 103 to suit your store. Ken Edited November 10, 2008 by GemRock commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Share this post Link to post Share on other sites