Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] PDF Customer Invoice


chris23

Recommended Posts

Contribution for email attachment

 

Have installed the Contribution for attaching the pdf-file to Order-Confirmation, and it works fíne.

 

But it will be nice if it takes in advance the following parameter:

"Only display invoice for delivered orders?", so if it is TRUE, the PDF-file is then first attached when the Order is delivered, and when set to FALSE, the PDF-file is then attached as now, when the Order-Confirmation is sent.

 

Does somebody have a suggestion to have the Contribution to work this way ?

:blush:

Link to comment
Share on other sites

Contribution for email attachment

 

Have installed the Contribution for attaching the pdf-file to Order-Confirmation, and it works fíne.

 

But it will be nice if it takes in advance the following parameter:

"Only display invoice for delivered orders?", so if it is TRUE, the PDF-file is then first attached when the Order is delivered, and when set to FALSE, the PDF-file is then attached as now, when the Order-Confirmation is sent.

 

Does somebody have a suggestion to have the Contribution to work this way ?

:blush:

 

Have solved the first Issue: Only send Ivoice-attachment if:

Only display Invoice for delivered orders = true , and

Attach PDF invoce to Customers Order Confirmation mail = true,

 

In checkout_process.php, the following is changed:

From:

if (PDF_INVOICE_EMAIL_ATTACHMENT == 'true' )

to:

if (PDF_INVOICE_EMAIL_ATTACHMENT == 'true' and DISPLAY_PDF_DELIVERED_ONLY == 'false' )

 

But my missing PHP-skills haven't come up with a solution how to attach the PDF-invoice to the mails send from the Admin-module, when status on the Order is "delivered". Have tried in a way like in the checkout_process.

Hope someone can bring me on the right Track.

Link to comment
Share on other sites

Hi All,

 

First off - great contrib!

 

I am having a bit of a problem running it with PayPal IPN v2.3.3 Payment module. It appears that Paypal IPN bypasses the checkout_process.php and therefore skips the point where the e-mail would usually be sent out.

 

ipn.php looks like the right place to stick in the bit of code which would usually go into checkout_process.php, specificaly in place of line

 

		  tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

however I have not been able to get the e-mail to work. Has anyone else been successful?

 

Thanks!

Link to comment
Share on other sites

Hi All,

 

First off - great contrib!

 

I am having a bit of a problem running it with PayPal IPN v2.3.3 Payment module. It appears that Paypal IPN bypasses the checkout_process.php and therefore skips the point where the e-mail would usually be sent out.

 

ipn.php looks like the right place to stick in the bit of code which would usually go into checkout_process.php, specificaly in place of line

 

		  tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

however I have not been able to get the e-mail to work. Has anyone else been successful?

 

Thanks!

 

Hi,

I don't use PayPal IPN but you're right in what you say. You need to duplicate the PDF code in ipn.php

I *think* from a brief look (and I haven't tested this), that you'll need to change the reference

$HTTP_GET_VARS['order_id'] = $insert_id;

 

to

 

$HTTP_GET_VARS['order_id'] = $HTTP_POST_VARS['invoice'];

 

to ensure the order_id gets passed to pdfinvoice.php

 

HTH

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

Thanks Christian, I tried it, but it didn't work. It looks like that the OSCommerce may be looking for PayPal to authenticate when it tries to access the ipn.php file after I change it (maybe to access pdfinvoice.php). And the request gets forwarded to login.php...

 

Any ideas?

 

 

 

Hi,

I don't use PayPal IPN but you're right in what you say. You need to duplicate the PDF code in ipn.php

I *think* from a brief look (and I haven't tested this), that you'll need to change the reference

$HTTP_GET_VARS['order_id'] = $insert_id;

 

to

 

$HTTP_GET_VARS['order_id'] = $HTTP_POST_VARS['invoice'];

 

to ensure the order_id gets passed to pdfinvoice.php

 

HTH

Link to comment
Share on other sites

I'm trying to use the pdfinvoice email attatchment together with Paypal Express Checkout, but I can't get it to work.

Have tried to insert the following in the Paypal Express file ppeb.php:

   // BEGIN added for pdfinvoice email attachment:

// Next line removed in original file
// tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 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:


/// --- end ---- checkout process email function

 

Hope somebody have an Idea

Link to comment
Share on other sites

Thanks Christian, I tried it, but it didn't work. It looks like that the OSCommerce may be looking for PayPal to authenticate when it tries to access the ipn.php file after I change it (maybe to access pdfinvoice.php). And the request gets forwarded to login.php...

 

Any ideas?

 

Now I've given this more than 10 seconds thought, there was an obvious step missing from my last post.

The file pdfinvoice.php has security checks in place to make sure that either:

 

1) The customer is logged in and can therefore only view invoices belonging to their customer id

 

or

 

2) The admin add-on is place and a security bypass hash is sent to pdfinvoice.php to bypass the requirement in 1)

 

This is where dealing with a payment module that uses a callback (eg PayPal, Chronopay etc) causes problems.

Harald's (hpdl) offical standard PayPal module replaces the checkout_process.php flow and pre-saves the order using code in the payment module. The ipn.php callback then updates the order status.

 

For this module, adding the PDF code to the payment module email block should work as the customer is logged in.

 

If you're using a different PayPal IPN that moves the email sending to the callback function, then the customer will not be logged in. In this case, I suppose the easiest solution would be to set the passthru id in the IPN page, e.g.

$HTTP_GET_VARS['passthruID'] = "your secrethashhere";

 

Note: all the above is based on my limited knowledge of the PayPal modules floating around the contribution area..

 

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

I'm trying to use the pdfinvoice email attatchment together with Paypal Express Checkout, but I can't get it to work.

 

 

See post #532

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,

 

I'm trying to find a way to move the Company Name and Company Address so that they are not at the right edge of the screen.

 

I have tried the previous fixes listed but they havent worked at all.

 

Any ideas? BTW, this is the bit in question on my pdfinvoice.php:

 

// Company name
           $this->SetX(0);
           $this->SetY(12);
           $this->SetFont(PDF_INV_CORE_FONT, 'B', 12);
           $this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
           $this->Ln(0);
           $this->Cell(150);
           $this->MultiCell(100, 3.5, tep_html_entity_decode(STORE_NAME), 0, 'L');

           // Company Address
           $this->SetX(0);
           $this->SetY(16);
           $this->SetFont(PDF_INV_CORE_FONT, 'B', 10);
           $this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
           $this->Ln(0);
           $this->Cell(150);
           $this->MultiCell(100, 3.5, tep_html_entity_decode(STORE_NAME_ADDRESS), 0, 'L');

Link to comment
Share on other sites

Just to update i found out how to do my above request. I changed the value of:

$this->Cell(125);

 

 

I have another question, on my pdf it shows http://www.carrickstationerysupplies.co.uk as the web address.

 

Is there any way to have just www.carrickstationerysupplies.co.uk instead?

 

Martyn

 

EDIT pdfinvoice.php

 

FIND:

 

$this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . HTTP_SERVER, 0, 'R');

 

REPLACE with:

 

$this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . str_replace("http://" , "", HTTP_SERVER), 0, 'R');

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

EDIT pdfinvoice.php

 

FIND:

 

$this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . HTTP_SERVER, 0, 'R');

 

REPLACE with:

 

$this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . str_replace("http://" , "", HTTP_SERVER), 0, 'R');

 

 

Thanks, that fixed it :)

Link to comment
Share on other sites

I'm download PDF_Customer_Invoice_v1.2 Contributions yesterday

 

my Server OS: Linux 2.4.33.2 Database: MySQL 4.0.26

Im using cartXpress for it.

 

After i update all the files from PDF_Customer_Invoice_v1.2,

 

but when after i update, the filename.php went error, it says the catalog can't find filename_line error message. So i have to get my backup filename.php and add (which is inside the install.txt)

 

// added customer pdf invoice

define('FILENAME_CUSTOMER_PDF','pdfinvoice.php');

// end added customer pdf invoice

 

manually, i'm not sure if i'm doing correctly but the website looks fine so far. So if i'm doing correct, now i have problem that how can i activate it?

 

It says look for readme.txt for configuration instructions. But when i read the readme.txt

 

it says " You should now have a new entry under configuration - PDF Invoices. The following explains how to use the options. "

 

But there is no PDF invoices under configuration, unless i look for the wrong place?? can someone help, thank you

 

 

i have attached my screen print

 

1y4jep.jpg

Link to comment
Share on other sites

One more question:

 

when customer click the pdf file when item "delivered".

 

without pop up the pfd invoice. it says

 

Warning: getimagesize(PDF_INVOICE_IMAGE) [function.getimagesize]: failed to open stream: No such file or directory in /home2/asgc-456/asgc-www/catalog/pdfinvoice.php on line 152

 

Warning: getimagesize(PDF_INVOICE_IMAGE) [function.getimagesize]: failed to open stream: No such file or directory in /home2/asgc-456/asgc-www/catalog/fpdf/fpdf.php on line 900

FPDF error: Image file has no extension and no type was specified: PDF_INVOICE_IMAGE

 

where do i go wrong??

 

Thx

Link to comment
Share on other sites

Have solved the first Issue: Only send Ivoice-attachment if:

Only display Invoice for delivered orders = true , and

Attach PDF invoce to Customers Order Confirmation mail = true,

 

In checkout_process.php, the following is changed:

From:

if (PDF_INVOICE_EMAIL_ATTACHMENT == 'true' )

to:

if (PDF_INVOICE_EMAIL_ATTACHMENT == 'true' and DISPLAY_PDF_DELIVERED_ONLY == 'false' )

 

But my missing PHP-skills haven't come up with a solution how to attach the PDF-invoice to the mails send from the Admin-module, when status on the Order is "delivered". Have tried in a way like in the checkout_process.

Hope someone can bring me on the right Track.

 

Hi

Has anyone a solution for this, to only attach the invoice to the confirmation e-mail when the status of the order is changed to "delivered"?

Happy 2009!

Lollo

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the great contribution. I have it installed and working. Is there any way to have the attachment also sent with the "extra order emails?" Currently they are getting the email without attachment.

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

alright I am getting this error:

 

Warning: require(fpdf/fpdf.php) [function.require]: failed to open stream: No such file or directory in admin/packingslip.php on line 26

 

Fatal error: require() [function.require]: Failed opening required 'fpdf/fpdf.php' (include_path='.:/usr/share/php:/usr/share/pear') admin/packingslip.php on line 26

Link to comment
Share on other sites

well now I got that first problem fix now I got this:

 

Warning: getimagesize(images/invoice_logo.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /fpdf/fpdf.php on line 900

 

Warning: getimagesize(images/invoice_logo.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /fpdf/fpdf.php on line 1542

FPDF error: Missing or incorrect image file: images/invoice_logo.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Can anybody help I get this message

Fatal error: Call to a member function add_current_page() on a non-object in 
/home/xxxxx/public_html/Site/includes/application_top.php on line 647

. This happens if I click on the PDF invoice button in customer order within the admin section. Trouble is it throws my whole store out of whack so I can not even see the store front all I get is this error.

 

I can move round the admin side ok.

 

Would be rerally graetful for some help.

 

Thanks Chris

Edited by clrob11

Better to be looked over than overlooked!

Link to comment
Share on other sites

well now I got that first problem fix now I got this:

 

Warning: getimagesize(images/invoice_logo.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /fpdf/fpdf.php on line 900

 

Warning: getimagesize(images/invoice_logo.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /fpdf/fpdf.php on line 1542

FPDF error: Missing or incorrect image file: images/invoice_logo.jpg

Sounds like the images/invoice_logo.jpg is not there or not accessible.

Link to comment
Share on other sites

Thanks for the great contribution. I have it installed and working. Is there any way to have the attachment also sent with the "extra order emails?" Currently they are getting the email without attachment.

 

Thanks

There is an addon for that, have a look in the contributions area.

Link to comment
Share on other sites

Can anybody help I get this message
Fatal error: Call to a member function add_current_page() on a non-object in 
/home/xxxxx/public_html/Site/includes/application_top.php on line 647

 

Google or forum search on "Fatal error: Call to a member function add_current_page() on a non-object". This is not an error specific to this contribution.

You'll find lots of fixes e.g. http://www.oscommerce.com/forums/index.php?showtopic=28405

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

Google or forum search on "Fatal error: Call to a member function add_current_page() on a non-object". This is not an error specific to this contribution.

You'll find lots of fixes e.g. http://www.oscommerce.com/forums/index.php?showtopic=28405

 

 

Thanks for your help I will investigate further.

Better to be looked over than overlooked!

Link to comment
Share on other sites

Just installed the contribution but am having trouble. I tried looking through the boards, but I couldn't find any information about the following error:

 

FPDF error: Incorrect orientation: shiplabel_portrait_landscape

 

Thanks in advance for any help!

Edited by DeBarlo
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...