Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] PDF Customer Invoice


chris23

Recommended Posts

the reason your email attachment is not working is becuase you have "mime html emails" enabled in configuration.

 

the step to disable that is missing from the email attachment install.

 

then you attachments will work.

Link to comment
Share on other sites

for those who are having issues with the mime email settings... this explains it a bit..

 

and will get your pdf added as an attachment instead of junk.

 

so when a customer orders, he gets an immediate email. so you want to turn off the "mime send emails option" in configuraton.

 

now your email attachments will work but the email will be text....

 

 

now if you are like me and have tracking links in your emails sent from admin when the order status is updated, then we want HTML MIME for those!!!!

 

how can we have both settings at once??

 

 

goto includes/functions/general.php and add this code to it:

also add it to admin/includes/functions/general.php

 

this is an always send mime html email regarless of "send html emails" is set to (becuase we set it to false to attach stuff)

 

  function tep_mailmime($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;

// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce Mailer'));

// Build the text version
$text = strip_tags($email_text);

  $message->add_html($email_text, $text);


// Send message
$message->build_message();
$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
 }

 

 

 

ok now we go edit /admin/orders.php

 

 

and for every function call to

 

 

tep_mail

 

 

we change it to

 

 

tep_mailmime

 

 

 

 

and thats it!!

 

 

 

now we are sending mime html emails on status updates (get those tracking links clickable in emails) and we are sending plain emails as attachments when someone completes a checkout in checkout_process.php

 

 

so by function and file its:

 

checkout_process.php using tep_mail with "use mime html" set to false

 

/admin/orders.php using tep_mailmime

Link to comment
Share on other sites

wokring with paypal IPN module (latest version 2.3.4.7)

 

well i got it working in checkout_process.php no problems.

 

 

however paypal IPN uses its own file in /ext/modules/payment/ipn.php

 

 

i pasted the code there

 

and updated the line to read:

 

$HTTP_GET_VARS['order_id']= $_POST(oid);

 

or whatever naming convention paypal ipn uses.... it uses a POST to pass the order # to the paypal ipn form.

 

it still didnt work with that update!!

 

soooo, if someone wants to give it a crack.

Link to comment
Share on other sites

for the person who suggest to put the abilitty to email in the admin panel...

 

i got this working!!

 

 

heres how i did it..

 

 

1. modify the same files on the store side in admin

 

/admin/includes/classes/email.php

 

and

 

/admin/includes/functions/general.php

 

with the normal email install stuff./

 

 

2. add the /admin/includes/languages/english/ * files that u need that are on the store side... same files.

 

 

3. copy pdfinvoice.php to /admin and rename pdfinvoicea.php

 

4. edit phpinvoicea.php and delete the security hash feature... (let htacess handle things since we are in admin now)

 

5. now edit /admin/orders.php and for every tep_mail function paste the text in the install for the email addon contrib......

which has the function tep_mail_string_with_addon or whatever it is.

 

 

now whenever you update an order status, it will email out a new invoice attached!

 

-mime emails must be turned off in config.

 

 

also when you 1st run it you may get some errors..

 

you will have to edit pdfinvoicea.php and update some "require" paths to "../whatever" to get it working.

 

but it works great!!

 

:)

Link to comment
Share on other sites

I have been trying to add the Manufacturers name alongside the Model No, by taking the post about adding the customer email and telephone number and amending accordingly. However, I haven't managed to achieve what I want I am afraid, mainly because that information is being added into a different place to the main headings.

 

Basically I want the headings to be:

 

Qty : Model : Manufacturer: Products : Total

 

I have managed to comment out the extra headings that I don't need, and also re layout all of the boxes, but this has me stumped!

 

Any help would be gratefully received.

 

Thanks,

 

Jonathan

Sorry to ask again, but after further investigation, I can't work out how to get the Manufacturer heading in there.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi

 

I have this contribution installed, but it seems that the pdf download link in account_history_info.php will only show up on some customers pages sometimes only on certain orders, others it will not, almost at random. IE: I have a customers account with 7 separate orders, but the pdf dowenload link only shows up on 3 of them. It doesn't matter what status I give it or change it to ( I have teied in admin to turn on/off (show when delivered only option). I have even looked directly in the database to compare what might be different or missing from the orders.

 

Anyone else having this problems? It's become very frustrating. PHP version 5.2.9

MySQL version 5.1.30.

 

Thanks!

- Ken

Link to comment
Share on other sites

I need UTF-8 charts, please HELP ME.

 

Thank you in advance

 

hello all,

any update/advice on that? i installed the addon, it works perfectly fine but the fonts in the pdf page are all messed up. i use a utf-8 database, w/greek fonts and i was wondering if there is a fix for this

 

(although i read somewhere that pdf format doesnt generally support unicode)

Edited by zeppos
Link to comment
Share on other sites

does anyone know how to add the invoice link to the checkout_success page? i have seen the option to attach the invoice to the confirmation email but i'd rather have the invoice ready when they are finished checking out.

Link to comment
Share on other sites

I'm trying to attach a PDF Invoice to an admin email so that customer automatically receives a copy of the PDF when their order is set to shipped.

 

I can view the PDF Invoice separately with no issues and the email works fine when I don't attempt to attach the PDF to it.

 

However when attaching the PDF, I always get the following in the pdfinvoice.php file. The line number used to say 110 until I took out a couple of commented lines. For security reasons, the domain name and passthruID have been changed / removed in the error message.

 

Parse error: syntax error, unexpected T_STRING in http://domain.com/pdfinvoice.php?order_id=...assthruID=...... on line 117

 

Any assistance would be grateful as I have checked all of the added code for this contribution and any modifications that might have been made and cannot see any errors.

Regards,

 

Steven Taylor

Link to comment
Share on other sites

I'm trying to attach a PDF Invoice to an admin email so that customer automatically receives a copy of the PDF when their order is set to shipped.

 

I can view the PDF Invoice separately with no issues and the email works fine when I don't attempt to attach the PDF to it.

 

However when attaching the PDF, I always get the following in the pdfinvoice.php file. The line number used to say 110 until I took out a couple of commented lines. For security reasons, the domain name and passthruID have been changed / removed in the error message.

 

Parse error: syntax error, unexpected T_STRING in http://domain.com/pdfinvoice.php?order_id=...assthruID=...... on line 117

 

Any assistance would be grateful as I have checked all of the added code for this contribution and any modifications that might have been made and cannot see any errors.

 

 

I did this by editing /admin/order.php when it sends out a notified email , it will attach the pdf to it....

 

pretty easy and it works great.

 

is that where you are trying to implement it?

Link to comment
Share on other sites

I did this by editing /admin/order.php when it sends out a notified email , it will attach the pdf to it....

 

pretty easy and it works great.

 

is that where you are trying to implement it?

 

Yes. I took the contribution and modified it so that it would attach it with an admin email instead of the order confirmation email. I track the problem back to somewhere in the changes that had to be made to the "pdfinvoice.php" file by way of commenting out the steps in the orders.php file until the error disappeared but when I checked the code and the related functions and classed for the changes in the "pdfinvoice.php" file, they were all good.

 

The only thing I can think of was that it wasn't reading the PDF Invoice into the streaming buffer properly.

 

I did manage to get around the problem by writing the PDF Invoice to a temporary file on the server and then attaching it to the invoice as a regular file if it existed. Once the email was sent, the file was removed from the server so as to avoid filling it up with unwanted data files. Not exactly the smoothest of operations and I'm sure it takes longer to do it that way than by streaming but it achieves the intended end result.

Regards,

 

Steven Taylor

Link to comment
Share on other sites

I have installed PDF Customer Invoice - Email PDF as Attachment and it works great. Is it supposed to also email a PDF invouce to admin? I do not get the attachment, only the customer does. If it is not supposed to email admin a PDF invoice attachment how can I alter it to do this?

 

Thanks,

 

Dan

Link to comment
Share on other sites

Hi installed this mod and its fantastic.

 

have two issues and they are minor at that.

 

1. some times the payment method falls extends beyond the box can this be wrapped like the comments? if so how please.

 

2. also the mod uses store name, address, web, email settings to automatically update the invoice, as I have the STORE_LOGO Mod added, it be better if Icould use 'STORE_LOGO' rather than images/store_logo.png I am guessing that this would be possible and that I need to find the associated code and amend it.

 

I havent installed the admin addition as dont see a need just yet, but may consider later.

 

Creat contribution

 

 

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Hi,

 

I have an issue when I click on confirm payment or when I try to c heck a pdf invoice in admin. I get this error

 

 

Warning: require(fpdf/fpdf.php) [function.require]: failed to open stream: No such file or directory in /home/xxxxxx/public_html/xxxxxxx/pdfinvoice.php on line 21

Warning: require(fpdf/fpdf.php) [function.require]: failed to open stream: No such file or directory in /home/xxxxxx/public_html/xxxxxxx/pdfinvoice.php on line 21

Fatal error: require() [function.require]: Failed opening required 'fpdf/fpdf.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxxx/public_html/xxxxxxx/pdfinvoice.php on line 21

 

Can any one help. I have searched forums but have not really seen any answers to this?

 

Be really greatful for any help.

Better to be looked over than overlooked!

Link to comment
Share on other sites

I resolved this issue for som reason my fpdf folder was missing??? but now when I try to open an invoice I get this error.

 

 

 

FPDF error: Some data has already been output, can't send PDF file

 

Can any one help?

 

Chris

Better to be looked over than overlooked!

Link to comment
Share on other sites

I just had a customer place an order and bought enough products to make the invoice more than one page. all the products are listed on the first page and there is no room left for the sub-total, shipping method, and total. so these should be placed on the second page. the problem is that on the second page it shows sub-total. then for some reason it skips to the third page to put the shipping method, and then it skips to a fourth page to place the total.

 

can someone tell me why it is doing this and how can i fix it? it really bothers me that there are four pages instead of two.

 

if you don't know what i am talking about then i can provide pictures to help, just ask.

Link to comment
Share on other sites

hi cristian,

 

this is a great contribution but can you make the format of text in comment box to appear like in account_history_info.php

 

like that:

Untitled.gif

thank you again

Dani

 

 

i already posted that addon to put comment box dynamically into PDF

Link to comment
Share on other sites

  • 4 weeks later...

Hi Christ..

I have use your contib "pdf customer invoice" and "pdf email attachment". But my store dont display price at the web. All price is by negotiate. I want change price(ex), price (inc), total (ex), total (inc) to weight, cbm, total weight, total cbm. Also SUb total and total at bottom to weight total, and cbm total. What i can do? Thank for your answer.

 

Note: weight and cbm are included in shopping cart confirmation

Link to comment
Share on other sites

Hi Christ..

I have use your contib "pdf customer invoice" and "pdf email attachment". But my store dont display price at the web. All price is by negotiate. I want change price(ex), price (inc), total (ex), total (inc) to weight, cbm, total weight, total cbm. Also SUb total and total at bottom to weight total, and cbm total. What i can do? Thank for your answer.

 

Note: weight and cbm are included in shopping cart confirmation

Link to comment
Share on other sites

Can anyone help with some quick questions.

 

On the top right of the invoice I have my store description and store address printing on top of each other. Although this is a small problem I would like to move the store address to the footer, which piece of code is for the address please?

 

Also how do I make the footer text bigger?

 

Finally, which piece of code makes the comments box bigger and then moves the actual comment down a line as it is currently bleeding into the comments box?

 

Thanks in advance

 

Michael

Link to comment
Share on other sites

Can anyone help with some quick questions.

 

On the top right of the invoice I have my store description and store address printing on top of each other. Although this is a small problem I would like to move the store address to the footer, which piece of code is for the address please?

 

Also how do I make the footer text bigger?

 

Finally, which piece of code makes the comments box bigger and then moves the actual comment down a line as it is currently bleeding into the comments box?

 

Thanks in advance

 

Michael

 

Its ok, while waiting I have sorted it myself.

Link to comment
Share on other sites

Hey hey....

 

I have been with a problem since the beginning of this great conti...

 

Next to this contri i have 'Prof_Invoice&PackingSlip_v0.2' installed.

When im in the Admin and get a invoice from there i have a different invoicenumber then the order-id.

 

I think it has something to do with this part of the code:

//Professional Invoice and Packing Slip START

 

//if you want your invoice starts to your last personal invoice number, set this -START-

$date_array = getdate();

$old_num = '1325';//last personal invoice number [cange to zero '0' if you start a new invoice series

$last_year_invoice = '2009'; // YEAR about your last personal invoice number

if ( $date_array[year]== $last_year_invoice)

{

$correction=$old_num;

}

else

{

$correction='0';

}

// your last personal invoice number -END-

 

// how many invoice in the last year -START-

$verify_data_query = tep_db_query("select date_invoice from " . TABLE_INVOICE . " where substring(date_invoice,7) < '".((int) $date_array[year]) . "'");

$count_num_invoice=mysql_num_rows($verify_data_query);

// how many invoice in the last year -END-

 

// invoice exist for this order

$verify_query = tep_db_query("select orders_id from " . TABLE_INVOICE . " where orders_id = '" . (int)$oID . "'");

$verify_id = tep_db_fetch_array($verify_query);

$sql_data_array = array('orders_id' => $oID);

if ($verify_id['orders_id'] == $oID)

{

}

// else insert date and invoice number for this order

else

{

$data_trasformed = date("d-m-Y");

tep_db_query("insert into " . TABLE_INVOICE . " (orders_id, date_invoice) values ('". (int)$oID . "','" .$data_trasformed ."')");

$num_actually = mysql_insert_id();

$num_invoice= ((int)$num_actually - (int)$count_num_invoice + $correction);

tep_db_query("update " . TABLE_INVOICE . " set num_invoice = ('".$num_invoice ."') where orders_id = '" . (int)$oID . "'");

}

// -END- invoice counting

 

$invoice_id_query = tep_db_query("select invoice_id, num_invoice from " . TABLE_INVOICE . " where orders_id = '" . (int)$oID . "'");

$invoice_id = tep_db_fetch_array($invoice_id_query);

// Professional Invoice and Packing Slip END

 

who can help me with this?

 

Thanx

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