Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] PDF Customer Invoice


chris23

Recommended Posts

Chris (or anybody...)

 

I've managed to sort out the http issue with my hosting provider. the Admin invoice pdf now manages to open but immediately reports an error: the logo file can't be found.

in admin/invoice.php it's defined as such:

 

//Logo
   $this->Image('images/logo_email.png',5,10,50);

 

this file path does exist within the catalog folder. Have tried to define the path in different ways but it keeps giving me the error....

 

I'm really lost now, combination of the pdf invoice.php together with fpdf doesn't seem to work at all my end.

Link to comment
Share on other sites

Ok, sorry, forget about it. My hosting co came back with another change in settings, issue seems to be sorted now!!

 

 

Chris (or anybody...)

 

I've managed to sort out the http issue with my hosting provider. the Admin invoice pdf now manages to open but immediately reports an error: the logo file can't be found.

in admin/invoice.php it's defined as such:

 

//Logo
   $this->Image('images/logo_email.png',5,10,50);

 

this file path does exist within the catalog folder. Have tried to define the path in different ways but it keeps giving me the error....

 

I'm really lost now, combination of the pdf invoice.php together with fpdf doesn't seem to work at all my end.

Link to comment
Share on other sites

Sorry....I know this is getting a bit of a soap....

 

I now have succesfully installed working versions of the PDF Customer Invoice 1.2 and the PDF invoice for Admin.

 

But...they're working with independant fpdf.php's (one in catalog, one in admin) and they both have their independant formats. Of course I can tweak one and not the other but that seems silly and a waste of work to me.

 

Bottom line: how can I tweak admin/invoice.php so that it looks to the configuration settings of the PDF Customer Invoice (because that pdf now looks great!!)

Link to comment
Share on other sites

Chris

I have 3 issues I need to sort out with the pdf Invoice

 

1st is the page overflow problem when the invoice goes over one page. I have tried reducing the number of page lines as suggested but this did not work. You did mention in one of your posts you new what was causing this and were going to look into a fix for it.

 

2nd problem I have been unable get the price column to line up on the top line when there is more than 1 line per product. I have managed to do all the other columns.

 

3rd is I have a column called ‘Quantity In pack’ I need this to get the data from table products products_quantity, but I believe it is not straight forward. Can you help. (at this time its set to get data from model).

 

I have enclosed a link to the invoice and my pdfinvoice.php (Zipped)

I hope you are someone else is able to point me in the right direction

 

Invoice PDF

 

pdfinvoice.php (Zipped)

Link to comment
Share on other sites

Chris

I have 3 issues I need to sort out with the pdf Invoice

 

1st is the page overflow problem when the invoice goes over one page. I have tried reducing the number of page lines as suggested but this did not work. You did mention in one of your posts you new what was causing this and were going to look into a fix for it.

 

2nd problem I have been unable get the price column to line up on the top line when there is more than 1 line per product. I have managed to do all the other columns.

 

3rd is I have a column called ‘Quantity In pack’ I need this to get the data from table products products_quantity, but I believe it is not straight forward. Can you help. (at this time its set to get data from model).

 

I have enclosed a link to the invoice and my pdfinvoice.php (Zipped)

I hope you are someone else is able to point me in the right direction

 

Invoice PDF

 

pdfinvoice.php (Zipped)

 

I have sorted out the 2nd problem but still not been able to sort the 1st or 3rd PLEASE HELP IF YOU CAN

Link to comment
Share on other sites

  • 2 weeks later...

Chris

 

This is a great contribution....thanks..

 

I installed the contrib with no probs, but then I installed another contrib for PDF for admin and now it doesn't attached a PDF to the email for the customer and when I attempt to view the invoice in the customer's order history, it won't present it there either.

 

Any ideas where the code may be that is not allowing this to work properly again.

 

Any assistance would be helpful.

 

 

Thanks

 

Kevin

Link to comment
Share on other sites

Chris

 

This is a great contribution....thanks..

 

I installed the contrib with no probs, but then I installed another contrib for PDF for admin and now it doesn't attached a PDF to the email for the customer and when I attempt to view the invoice in the customer's order history, it won't present it there either.

 

Any ideas where the code may be that is not allowing this to work properly again.

 

Any assistance would be helpful.

 

 

Thanks

 

Kevin

 

i believe chris' pdf invoice includes the admin bit so you should not install the invoice for admin if you already installed the former.

 

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.

Link to comment
Share on other sites

i believe chris' pdf invoice includes the admin bit so you should not install the invoice for admin if you already installed the former.

 

Ken

 

@Kevin - which other contribution did you install? If it's Ken's, then this should be uninstalled and the "Admin Access" addon to the base PDF Customer Invoice should be installed.

 

@Ken - the base contribution doesn't have the admin facility by default. The way the contribution has evolved has been confusing to say the least:

 

Initially my contribution was a rewrite of PDF Invoices. This was purely an admin side tool to generate PDFs for store owners. I modified this to generate the PDFs client side from within customers' accounts. I advised anyone wanting an admin tool to just use the original contribution.

 

I then got requests to allow admin access to the PDFs (as my contribution allowed for easier modification of the PDF). This add on to the base install is entirely optional.

 

The email as an attachment is also an addon that requires the base contribution but not the admin addon.

 

Your contribution is basically doing what I did in reverse - removing the client side access but retaining admin generation.

 

This post was supposed to make things clearer but I think I've done the opposite ....

 

Rgds,

 

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,

 

Yes, I believe that it very may had been Ken's contrib that I installed afterwards. I thought that I had uninstalled the whole package and I still can get the attachment to the email. Do you think that installing your admin part would correct the problem?

 

Thanks

 

Kevin

Link to comment
Share on other sites

Do you think that installing your admin part would correct the problem?

 

It would be a good place to start - at least I'l know what I'm debugging.

 

Chris

Edited by chris23

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 am still having problems with the page overflow problems can you or anyone else please help

 

Sorry Jonathan - missed your post (my email notifications appear not to be working)

I have various pdfinvoices.php. modified to try and fix the page break issue. I'll dig them out over the weekend and send them over (PM me your email address)

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

It would be a good place to start - at least I'l know what I'm debugging.

 

Chris

 

 

 

Which post of your contribtion for the admin part should I install if I had already installed the other part for the customer?

 

Thanks

 

Kevin

Link to comment
Share on other sites

Chris,

 

I added your admin invoice add on, but I still can't get a pdf attached to the email sent to the customer, nor can I see a copy of the attachment to the order history on a customer's account.

 

Any ideas where this might be that creates the error?

 

Thanks

 

Kevin

Link to comment
Share on other sites

I added your admin invoice add on, but I still can't get a pdf attached to the email sent to the customer, nor can I see a copy of the attachment to the order history on a customer's account.

 

Kevin,

 

There are two separate issues here. There is no copy of the attachment in the customer's account history. In the account page, there is a link to generate a PDF copy of the invoice. This is generated each time the customer clicks the link. It is streamed directly to the browser and is not stored or attached.

 

Do you get a link in the account history which when clicked, displays an invoice?

 

Second issue with emailing. Assuming you have installed the "email as an attachment" addon, do you get any errors when proceeding through checkout when you enable the email pdf attachment option?

 

Rgds,

 

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

Sorry Jonathan - missed your post (my email notifications appear not to be working)

I have various pdfinvoices.php. modified to try and fix the page break issue. I'll dig them out over the weekend and send them over (PM me your email address)

Chris

Chris

Have not herd back from you re problem with page overflow.

Did you get my email address

 

Jonathan

Link to comment
Share on other sites

Chris,

 

I need some help with PDF Invoice. I cannot figure out how to get it to print the document size as Letter (8.5 x 11 inches). It always defaults to A4 paper size (8.3 x 11.7 in).

 

I have tried tweaking the variables in pdfinvoice.php - line 253, function PDF_EPS($orientation='P',$unit='mm',$format='letter'){

 

And I have tried hard-coding FPDF.php by altering the default on line 79 to - function FPDF($orientation='P',$unit='mm',$format='letter')

 

No matter what I do, nothing seems to work. It's frustrating to me that the variables don't seem to do anything.

 

I'm stumped.

 

Thanks.

 

David

Link to comment
Share on other sites

Chris,

 

I need some help with PDF Invoice. I cannot figure out how to get it to print the document size as Letter (8.5 x 11 inches). It always defaults to A4 paper size (8.3 x 11.7 in).

 

I have tried tweaking the variables in pdfinvoice.php - line 253, function PDF_EPS($orientation='P',$unit='mm',$format='letter'){

 

And I have tried hard-coding FPDF.php by altering the default on line 79 to - function FPDF($orientation='P',$unit='mm',$format='letter')

 

No matter what I do, nothing seems to work. It's frustrating to me that the variables don't seem to do anything.

 

I'm stumped.

 

Thanks.

 

David

 

David,

 

Hardcoding, while not ideal, should work fine. Are you sure you're not getting browser caching issues? I occasionally have problems trying to get changes to "stick" when regenerating the PDF. Often clearing the browser cache or a CTRL +F5 fixes this.

 

Rather than hardcode, try adding a constructor to the PDF class (this is something I need to add as a config option as the A4/letter issue has been discussed before).

 

EDIT pdfinvoice.php

 

FIND:

 

class PDF extends FPDF
{

 

and ADD immediately after:

 

function PDF($orientation='P',$unit='mm',$format='letter'){
parent::FPDF($orientation,$unit,$format);
}

 

I've not tested this but it should create a FPDF object with the canvas set to letter, not A4 size

 

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

Chris,

 

Thanks for your reply. I shall try this over the weekend and let you know. In the meantime, a quick response...

 

1. I am using FireFox 3

2. Tried the cache flush already with forced refresh

3. Also tried shutdown of FF3 and reboot

 

None of that has worked so far, but I shall try your PHP suggestion and get back to you.

 

Thanks. :)

 

Regards,

 

David

 

 

David,

 

Hardcoding, while not ideal, should work fine. Are you sure you're not getting browser caching issues? I occasionally have problems trying to get changes to "stick" when regenerating the PDF. Often clearing the browser cache or a CTRL +F5 fixes this.

 

Rather than hardcode, try adding a constructor to the PDF class (this is something I need to add as a config option as the A4/letter issue has been discussed before).

 

EDIT pdfinvoice.php

 

FIND:

 

class PDF extends FPDF
{

 

and ADD immediately after:

 

function PDF($orientation='P',$unit='mm',$format='letter'){
parent::FPDF($orientation,$unit,$format);
}

 

I've not tested this but it should create a FPDF object with the canvas set to letter, not A4 size

 

HTH

 

Chris

Link to comment
Share on other sites

Chris,

 

Ok... I feel like you are the mechanic and I've just driven my car over to show you something's wrong, and voila... it works.

 

I just tried the test store and the darn thing is working! I don't know what has changed other than the fact that I added the PDF Packing Slip Admin update this morning. Maybe there was some stuff stuck in cache on the server. Who knows. However, it seems to work properly now, sans the Class Constructor adjustment you mentioned.

 

Thanks for your help either way, and btw great contribution!

 

Regards,

 

David

 

 

David,

 

Hardcoding, while not ideal, should work fine. Are you sure you're not getting browser caching issues? I occasionally have problems trying to get changes to "stick" when regenerating the PDF. Often clearing the browser cache or a CTRL +F5 fixes this.

 

Rather than hardcode, try adding a constructor to the PDF class (this is something I need to add as a config option as the A4/letter issue has been discussed before).

 

EDIT pdfinvoice.php

 

FIND:

 

class PDF extends FPDF
{

 

and ADD immediately after:

 

function PDF($orientation='P',$unit='mm',$format='letter'){
parent::FPDF($orientation,$unit,$format);
}

 

I've not tested this but it should create a FPDF object with the canvas set to letter, not A4 size

 

HTH

 

Chris

Link to comment
Share on other sites

Chris

Have not herd back from you re problem with page overflow.

Did you get my email address

 

Jonathan

 

I did pm it to you have done it again last week will do it again now as I need to get this problem sorted before my new site goes live.

Link to comment
Share on other sites

Have installed this great contribution.

 

I'm just having a " "-issue, which I can't solve myself:

 

In the created PDf-file, all Currency-Values are surrounded with " " t.ex:

Under column:

Total(ex)

 DKK 2.855,00 

 

This disturbes the formatting in the PDF-file.

 

Hope someone can help me where to change this formatting of all the Currency-Values.

Link to comment
Share on other sites

Have installed this great contribution.

 

I'm just having a " "-issue, which I can't solve myself:

 

In the created PDf-file, all Currency-Values are surrounded with " " t.ex:

Under column:

Total(ex)

 DKK 2.855,00 

 

This disturbes the formatting in the PDF-file.

 

Hope someone can help me where to change this formatting of all the Currency-Values.

 

 

You can't have any html or html entities in your PDF.

 

If your payment module is inserting these characters, edit pdfinvoice.php

 

FIND

$pdf->MultiCell(94, 6, $order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'], 0, 'R');

 

and add the tep_html_entity_decode function around $order->totals[$i]['title'] and $order->totals[$i]['text']

 

e.g

 

$pdf->MultiCell(94, 6, tep_html_entity_decode($order->totals[$i]['title']) . ' ' . tep_html_entity_decode($order->totals[$i]['text']), 0, 'R');

 

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

You can't have any html or html entities in your PDF.

 

If your payment module is inserting these characters, edit pdfinvoice.php

 

FIND

$pdf->MultiCell(94, 6, $order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'], 0, 'R');

 

and add the tep_html_entity_decode function around $order->totals[$i]['title'] and $order->totals[$i]['text']

 

e.g

 

$pdf->MultiCell(94, 6, tep_html_entity_decode($order->totals[$i]['title']) . ' ' . tep_html_entity_decode($order->totals[$i]['text']), 0, 'R');

 

HTH

 

Thanks Chris23, it solved the Issue !!! :rolleyes: :rolleyes:

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...