Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] PDF Customer Invoice


chris23

Recommended Posts

My http server is shop.pipeloops.com, the https server is sssl.kundenserver.de/shop.pipeloops.com (guess you know that's 1und1?). The link properties show
https://ssl.kundenserver.de/shop.pipeloops.com//pdfinvoice.php?order_id=87&osCsid=986e4610ca58f9955e0fa8d54fafbf56

. When I click the link, I get "Internet explorer caanot download pdfinvoice.php from sssl.kundenserver.de".

Any idea?

 

Reiner

 

Have a look at post # 248 here

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

A quick question, any plans for a batch print option - using FPDF in the future?

 

Hi Jodes,

 

Thanks for your comments.

 

Regarding your query, what exactly are you after? I'm guessing you're after something like a checkbox next to each order on the order details page, then a "Bulk PDF Print" button that will generate one single PDF with each selected order "page-breaked" within the PDF??

 

If you give me a full idea of what you want, I'll give it some though (no promises mind!)

 

Cheers

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

Chris,

 

I just finished installing PDF Packing Slip. Another GREAT contribution. PDF Invoice and PDF Packing Slip together give the store a cohesive, professional look.

 

I do have one comment, and one question.

 

The comment. In the instruction for modifying catalog/admin/orders.php

<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_PDF_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip_pdf.gif', IMAGE_ORDERS_PDF_PACKINGSLIP) . '</a>

and

<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_PDF_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip_pdf.gif', IMAGE_ORDERS_PDF_PACKINGSLIP) . '</a>

The last part of each line has

tep_image_button('button_packingslip_pdf.gif', IMAGE_ORDERS_PDF_PACKINGSLIP)

.

That should read

tep_image_button('button_pdfpackingslip.gif', IMAGE_ORDERS_PDF_PACKINGSLIP)

That matches the actual button name, button_pdfpackingslip.gif.

 

Question. Where dose the top line above put the button?

 

Again, great contribution.

 

Thanks,

Rick

Link to comment
Share on other sites

Chris,

 

I installed the PDF Packing Slip contrib today and it works beautifully. I also installed the PDF Invoice Email contribution. That didn't go as well. After installing the contrib I ran a test sale and instead of the sale completing and the customer getting the confirmation email, the customer is redirected to the customer_history page. The order confirmation email is not sent to store owner or customer, but the order does show up in the customer_history page as pending and it shows up in admin/orders, also as pending. Also, the customers session is not closed out as it would be with a completed order. I probably put the code in checkout_process.php in the wrong place, I have a very heavily modified store and adding new contributions sometimes get a bit tricky. Any idea what I may have done wrong?

 

Thanks again,

Rick

Link to comment
Share on other sites

Chris,

 

I installed the PDF Packing Slip contrib today and it works beautifully. I also installed the PDF Invoice Email contribution. That didn't go as well. After installing the contrib I ran a test sale and instead of the sale completing and the customer getting the confirmation email, the customer is redirected to the customer_history page. The order confirmation email is not sent to store owner or customer, but the order does show up in the customer_history page as pending and it shows up in admin/orders, also as pending. Also, the customers session is not closed out as it would be with a completed order. I probably put the code in checkout_process.php in the wrong place, I have a very heavily modified store and adding new contributions sometimes get a bit tricky. Any idea what I may have done wrong?

 

Thanks again,

Rick

 

Quick correction to the above. The customer is redirected to the account_history page.

 

Rick

Edited by CatDadRick
Link to comment
Share on other sites

Regarding your query, what exactly are you after? I'm guessing you're after something like a checkbox next to each order on the order details page, then a "Bulk PDF Print" button that will generate one single PDF with each selected order "page-breaked" within the PDF??

 

Yes, exactly - nothing fancy just something to make it a little easier when processing orders for the day.

 

I tried to edit a couple of the other batch print modules, but i'm not a coder (although can find my way about) and haven't had any experience with the PDF programs so don't understand exactly how they function, but had no luck.

 

Thanks again for your help.

 

Jodes

Link to comment
Share on other sites

The comment. In the instruction for modifying catalog/admin/orders.php

<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_PDF_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip_pdf.gif', IMAGE_ORDERS_PDF_PACKINGSLIP) . '</a>

and

<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_PDF_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip_pdf.gif', IMAGE_ORDERS_PDF_PACKINGSLIP) . '</a>

The last part of each line has

tep_image_button('button_packingslip_pdf.gif', IMAGE_ORDERS_PDF_PACKINGSLIP)

.

That should read

tep_image_button('button_pdfpackingslip.gif', IMAGE_ORDERS_PDF_PACKINGSLIP)

That matches the actual button name, button_pdfpackingslip.gif.

 

Question. Where dose the top line above put the button?

 

Hi Rick,

 

Pleased you like the contrib.

 

You have two entries for the button as the orders.php page runs in two "modes", the preview mode that details all orders, plus the edit / view page that actually allows you to process the order. In order to have a packing slip button on each "mode", you need the two entries

 

HTH

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

Reiner

 

Have a look at post # 248 here

 

Chris

Hi Chris,

 

thanks for your reply. This post applied to a problem in the admin part, Ihave the problem fromt he user account_history_info.php. I adapted the link as follows:

			<td  class="main"><?php echo tep_image(DIR_WS_IMAGES . 'pdf.gif', 'PDF invoice','','','style="vertical-align:middle"') . sprintf(PDF_DOWNLOAD_LINK,
		tep_href_link(FILENAME_CUSTOMER_PDF, 'order_id=' . $HTTP_GET_VARS['oID'] . '&passthruID=' . $pass_phrase_hash, 'SSL')); ?></td>

which now bounces me back to the account_history.php. Must be something more missing. Any idea?

 

Thanks

Reiner

Link to comment
Share on other sites

Quick correction to the above. The customer is redirected to the account_history page.

 

 

Rick,

 

Have a look at post #292 here. I strongly suspect my botched code is causing your issue.

 

HTH

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

Tried installing PDF Customer Invoice 1.1 on RC2a today: straightforward installation, but will not work for me.

 

Noticed that the SQL completes and only the first 16 of the 18 items in the Admin config are present - yet the SQL statement does have all 18.

 

Any thoughts?

Link to comment
Share on other sites

Rick,

 

Have a look at post #292 here. I strongly suspect my botched code is causing your issue.

 

HTH

 

Chris

Chris,

 

I made the modification shown in post 292, but that didn't change things much. Yesterday when I added the contribution I think (underline think) the test sales redirected the customer to account_history regardless of whether Attach PDF Invoice was set True or False. After the change to include_once, the customer is redirected to account_history only if Attach PDF Invoice is set True in admin. I Think. I didn't test it as much as I could have because I discovered the problem on my live store and wanted to correct things quickly. More testing on my test store confirmed the problem. With Attach PDF Invoice set True the customer is redirected to account_history, no emails are sent to customer or store owner. With Attach PDF set False everything works normally and emails are sent to customer and store owner.

 

Thanks,

Rick

Link to comment
Share on other sites

Tried installing PDF Customer Invoice 1.1 on RC2a today: straightforward installation, but will not work for me.

 

Noticed that the SQL completes and only the first 16 of the 18 items in the Admin config are present - yet the SQL statement does have all 18.

 

Any thoughts?

 

OK, fixed it - as soon as I understood the warning in the Installation notes!

 

Worked brilliantly, so I installed the addons related to attaching to email. Now this doesn't work - same content in the email as mentioned by others in recent days - but I have implemented the suggestions.

 

What may be significant is that standard HTML emails don't work either.

Link to comment
Share on other sites

@CatDadRick

@cornishpirate

 

You guys seem to be having the same problem so I'll get you both to try the following. The code below is lifted from my copy of checkout_process.php )which is working on 2 test and 2 live servers)

 

EDIT checkout_process.php

 

REPLACE your code block,

 

// BEGIN added for pdfinvoice email attachment:

blah .....

// END added for pdfinvoice email attachment:

 

with

 

// BEGIN added for pdfinvoice email attachment:

if (PDF_INVOICE_EMAIL_ATTACHMENT == 'true') {
	// customers will be logged in so usual security checks of pdfinvoice.php will be met. All we do is set the order_id for pdfinvoice.php to pick up
	$HTTP_GET_VARS['order_id'] = $insert_id;
	// set stream mode
	$stream = true;
	// include pdfinvoice.php
	include_once(FILENAME_CUSTOMER_PDF);
	// add text to email informing customer a pdf invoice copy has been attached:
	$email_order .= PDF_INVOICE_ATTACHED ."\n\n";
	// send email with pdf invoice attached. Check to make sure pdfinvoice.php returns some data, else send standard email
	// note $order object reinstantiated by inclusion of pdfinvoice.php hence customer['name']
	if (tep_not_null($pdf_data)) {
		tep_mail_string_attachment($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $pdf_data, $file_name);
	} else {
		tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
	}
} else {
	// send vanilla e-mail - if email attachment option is false
	tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}

// END added for pdfinvoice email attachment:

 

If this is still bombing when you try, add before

 

 // set stream mode

 

echo $HTTP_GET_VARS['order_id'];
die();

 

and let me know what value for order_id is output (if any). Then remove this code. The only reason I can see for you getting bounced back to account_history.php is if pdfinvoice.php doesn't get passed an order id (or if a customer is not logged in which can't be the case during checkout!)

 

HTH

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

@CatDadRick

@cornishpirate

 

You guys seem to be having the same problem so I'll get you both to try the following. The code below is lifted from my copy of checkout_process.php )which is working on 2 test and 2 live servers)

 

 

 

and let me know what value for order_id is output (if any). Then remove this code. The only reason I can see for you getting bounced back to account_history.php is if pdfinvoice.php doesn't get passed an order id (or if a customer is not logged in which can't be the case during checkout!)

 

HTH

 

Chris

 

Chris,

 

This is almost working. After applying the new code and enabling PDF Invoice Email, the order is completed and the customer is redirected to the order_success page and the store owner email is sent, however, the customer confirmation is not sent. Even after several minutes. Any other ideas?

 

Thanks,

Rick

Link to comment
Share on other sites

Downloaded the add-on and I like the idea and all but can't get it to work...I'm getting this error message in OSC 2.2 RC2a

 

Warning: getimagesize(/home/content/g/a/m/games4gamers/html/catalog/PDF_INVOICE_IMAGE): failed to open stream: No such file or directory in /home/content/g/a/m/games4gamers/html/catalog/admin/pdfpackingslip.php on line 123

FPDF error: Image file has no extension and no type was specified: /home/content/g/a/m/games4gamers/html/catalog/PDF_INVOICE_IMAGE

 

Here is the code from around that section of the file (AFAIK):

 

            //Logo
           $size = getimagesize(DIR_FS_CATALOG. PDF_INVOICE_IMAGE);
           $this->$image_function(DIR_FS_CATALOG . PDF_INVOICE_IMAGE, 7, 10, ($size[0] * PDF_INV_IMG_CORRECTION), ($size[1] * PDF_INV_IMG_CORRECTION), '', FILENAME_DEFAULT);

 

Do I need to change something? My image file name is invoice_logo.jpg...Thanks for any help.

Edited by games4gamers
Link to comment
Share on other sites

Rob,

 

Apologies to you. Now you've confirmed the same problem as KJ, I can see exactly what's happening.

 

I've changed my osc test system to be PHP5 ready which means I've replaced all instances of $HTTP_GET_VARS and $HTTP_POST_VARS to their superglobal equivalents, $_GET and $_POST.

 

What I've done, without thinking, is use $_GET in checkout_process.php instead of $HTTP_GET_VARS. What's happening in your case is no order id is being passed to pdfinvoice.php so it thinks it's being hacked and bounces you to account_history, as it should.

 

To fix this,

 

EDIT checkout_process.php

 

FIND

 

$_GET['order_id'] = $insert_id;

 

and change to:

 

$HTTP_GET_VARS['order_id'] = $insert_id;

 

This should 'GET' you (c**p pun), up and running!

 

Sincere apologies. This is why I ask for people's PHP versions as many are making the move to PHP5 and unpredictable behaviours like this are happening.

@KJ This is your problem too! Sorry ....

 

Cheers

 

Chris

 

Thank you, thank you! I've been fiddling around with the same problem as above. The solution worked like a charm.

 

Chris, thank you so much for this contrib and for taking the time to be so helpful - you rock!

Link to comment
Share on other sites

Hi KJ,

 

If you turn on error reporting, do you get any generated errors that could help?

 

Cheers

 

Chris

 

Hi Chris,

(when the attach pdf is enabled) the white screen "syntax error of death screen" I have found this as the error:

-------------------------------

[client 67.46.129.30] PHP Fatal error: Cannot redeclare class order in /home/virtual/site1/fst/var/www/html/includes/classes/order.php on line 23, referer:

https://secure.msrootserve.com/gokartsrus.c...1fcdb3a13f3667f

-------------------------------

 

Here's a snippet of includes/classes/order.php (2nd line is of error mentioning)

class order {
var $info, $totals, $products, $customer, $delivery, $content_type;

 

Hope we can clear this up... I really like the "attach" pdf add-on!

Thanks,

KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

@CatDadRick

@cornishpirate

 

You guys seem to be having the same problem so I'll get you both to try the following. The code below is lifted from my copy of checkout_process.php )which is working on 2 test and 2 live servers)

 

EDIT checkout_process.php

 

REPLACE your code block,

 

// BEGIN added for pdfinvoice email attachment:

blah .....

// END added for pdfinvoice email attachment:

 

with

 

// BEGIN added for pdfinvoice email attachment:

if (PDF_INVOICE_EMAIL_ATTACHMENT == 'true') {
	// customers will be logged in so usual security checks of pdfinvoice.php will be met. All we do is set the order_id for pdfinvoice.php to pick up
	$HTTP_GET_VARS['order_id'] = $insert_id;
	// set stream mode
	$stream = true;
	// include pdfinvoice.php
	include_once(FILENAME_CUSTOMER_PDF);
	// add text to email informing customer a pdf invoice copy has been attached:
	$email_order .= PDF_INVOICE_ATTACHED ."\n\n";
	// send email with pdf invoice attached. Check to make sure pdfinvoice.php returns some data, else send standard email
	// note $order object reinstantiated by inclusion of pdfinvoice.php hence customer['name']
	if (tep_not_null($pdf_data)) {
		tep_mail_string_attachment($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $pdf_data, $file_name);
	} else {
		tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
	}
} else {
	// send vanilla e-mail - if email attachment option is false
	tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}

// END added for pdfinvoice email attachment:

 

If this is still bombing when you try, add before

 

 // set stream mode

 

echo $HTTP_GET_VARS['order_id'];
die();

 

and let me know what value for order_id is output (if any). Then remove this code. The only reason I can see for you getting bounced back to account_history.php is if pdfinvoice.php doesn't get passed an order id (or if a customer is not logged in which can't be the case during checkout!)

 

HTH

 

Chris

 

Cornishpirate, did this work for you?

 

Thanks,

Rick

Link to comment
Share on other sites

Do I need to change something? My image file name is invoice_logo.jpg...Thanks for any help.

 

Hi,

 

I see this is the packingslip add-on you have trouble with. Have you installed the parent PDF Invoice contribution as you appear to have the database configuration values missing?

 

HTH

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

(when the attach pdf is enabled) the white screen "syntax error of death screen" I have found this as the error:

-------------------------------

[client 67.46.129.30] PHP Fatal error: Cannot redeclare class order in /home/virtual/site1/fst/var/www/html/includes/classes/order.php on line 23, referer:

https://secure.msrootserve.com/gokartsrus.c...1fcdb3a13f3667f

-------------------------------

 

KJ,

 

Have a look at post #280 here

 

I think this will fix you up.

 

Cheers

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

This is almost working. After applying the new code and enabling PDF Invoice Email, the order is completed and the customer is redirected to the order_success page and the store owner email is sent, however, the customer confirmation is not sent. Even after several minutes. Any other ideas?

 

Hi Rick,

 

If the only thing failing now is the attachment email, please have a quick look over the changes you made to the mail function in includes/general.php and the change in includes/classes/email.php.

 

Also, you do have:

 

// are we streaming for email attachment or outputting to browser?
if($stream){
$pdf_data = $pdf->Output('' , 'S');
} else {
$mode = (FORCE_PDF_INVOICE_DOWNLOAD == 'true') ? 'D' : 'I';
// what do we do? display inline or force download
$pdf->Output($file_name , $mode);
}

at the end of pdfinvoice.php?

 

Cheers

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

This post applied to a problem in the admin part, Ihave the problem fromt he user account_history_info.php. I adapted the link as follows:

			<td  class="main"><?php echo tep_image(DIR_WS_IMAGES . 'pdf.gif', 'PDF invoice','','','style="vertical-align:middle"') . sprintf(PDF_DOWNLOAD_LINK,
		tep_href_link(FILENAME_CUSTOMER_PDF, 'order_id=' . $HTTP_GET_VARS['oID'] . '&passthruID=' . $pass_phrase_hash, 'SSL')); ?></td>

 

Reiner,

 

Sorry - should have read your post more carefully. I pointed you at that post as there is a minor bug in the admin link which gives a url with // in it like you seem to have!

 

Assuming the format https://ssl.kundenserver.de/shop.pipeloops.com/ is correct for accessing the shared SSL, have a look at your path entries includes/config.php. I'm not sure this is your issue but the url should be

 

https://ssl.kundenserver.de/shop.pipeloops....e0fa8d54fafbf56

 

not

 

https://ssl.kundenserver.de/shop.pipeloops....e0fa8d54fafbf56

 

IE might be choking on the //pdfinvoice.php

 

Have you tried the same link in a 'real' browser e.g. Opera/Firefox?

 

HTH

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

you rock!

 

Steady on girl!

 

Sorry you had a problem. When I get a chance I'll upload what will hopefully be a final version of the install instructions, taking account of all the fixes on the forum.

 

Cheers

 

Chris

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Link to comment
Share on other sites

Hi Rick,

 

If the only thing failing now is the attachment email, please have a quick look over the changes you made to the mail function in includes/general.php and the change in includes/classes/email.php.

Chris,

 

Seems I missed step 7, the modifications to general.php, too much staring at code I think :blink:. Now that I've added the function I'm sure it'll work.

 

Thanks,

Rick

Link to comment
Share on other sites

Chris,

 

OK, I've added the changes to includes/functions/general.php and now the sale is completed and the customer is redirected to the checkout_success page and the order confirmation emails are sent. Problem now is, the customer's email is blank. I can see that an attachment is there, but 3 email clients can't open it. In Evolution, the mail message contains the base64 encoded message, but there is no readable information.

 

Any Ideas?

 

Thanks again,

Rick

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...