Skip to main content

PDF invoice

More
15 years 6 months ago #9505 by emergentec
PDF invoice was created by emergentec
Hi!

Is it possible to attach the invoice as a PDF instead of HTML to the confirmation mail send to a customer after an order is created?

Best regards
The following user(s) said Thank You: klimmbimm

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #9506 by nicolas
Replied by nicolas on topic Re: PDF invoice
Hi,

Well, everything is possible, if you know how to code it :)

In the business edition of HikaShop, you can edit the emails via the menu System->Emails. There, you will be able to use the joomla PDF library to generate a PDF. It's not so easy and only on joomla 1.5. On 1.6, the library was removed. You can always use another PDF library.
You can then attach it to the email quite easily with a few lines of code:
$attachObj = null;
$attachObj->name = 'invoice.pdf';
$attachObj->filename = '/home/user/www/path/to/invoice.pdf';
$attachObj->url = ' www.mywebsite.com/path/to/invoice.pdf ';
$mail->attachments = array($attachObj);

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10805 by emergentec
Replied by emergentec on topic Re: PDF invoice
Which PDF library would you recommend to use?

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10806 by nicolas
Replied by nicolas on topic Re: PDF invoice
You can use the same one as in joomla 1.5 : www.tcpdf.org/

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10812 by emergentec
Replied by emergentec on topic Re: PDF invoice
Where or how can I get the HTML stream to write it with the PDF library to a PDF-file?

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10813 by nicolas
Replied by nicolas on topic Re: PDF invoice
In the email itself...The email has the summary of the order in it. So you can directly use it in the email to generate the PDF and attach it to the email.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10825 by emergentec
Replied by emergentec on topic Re: PDF invoice
nicolas wrote:

In the email itself...The email has the summary of the order in it. So you can directly use it in the email to generate the PDF and attach it to the email.

You mean in the HTML version textfield?

But how can I get the full HTML stream, to add it to the PDF, like
Code:
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', [b]$html[/b]...

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #10843 by nicolas
Replied by nicolas on topic Re: PDF invoice
Yes, the HTML version.

You can add a ob_start(); at the beginning of the email.
Then, at the end of it:
$html = ob_get_contents();
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html...

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago - 15 years 6 months ago #11560 by emergentec
Replied by emergentec on topic Re: PDF invoice
I need to have 2 different HTML strings to have a good HTML-layout in the mail itself and also in the PDF.

I tried it with
Code:
$html = <<<EOD <div style="background-color:...

but I do have problems when I come to PHP-Code

<?php echo JText::sprintf('HI_CUSTOMER',@$data->customer->name);?>

How can I solve this problem?

Thanks!
Last edit: 15 years 6 months ago by emergentec.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #11571 by nicolas
Replied by nicolas on topic Re: PDF invoice
Just copy/paste the default email to have it displayed twice. Then, for one of the two, you can use the code I posted above and do your customizations for the PDF.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #12087 by emergentec
Replied by emergentec on topic Re: PDF invoice
nicolas wrote:

Just copy/paste the default email to have it displayed twice. Then, for one of the two, you can use the code I posted above and do your customizations for the PDF.

Then the HTML invoice is displayed twice in the mail, which isn't really a solution.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #12093 by nicolas
Replied by nicolas on topic Re: PDF invoice
No.

If have such script nothing is displayed :
<?php ob_start(); ?>
<p>some text that won't be displayed<?php echo ' and some more text'; ?></p>
<?php $html = ob_get_clean(); ?>

and you have all your HTML in the $html variable. You can use it to do whatever you want, independently from the display.

Please Log in or Create an account to join the conversation.

More
15 years 6 months ago #12217 by emergentec
Replied by emergentec on topic Re: PDF invoice
I used "ob_get_contents();" from a post above, then it's displayed twice. Thanks! :)

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #134362 by nicolas
Replied by nicolas on topic Re: PDF invoice
Please note that there is now a PDF invoice plugin available for HikaShop:
www.hikashop.com/component/hikashop/product/cid-18.html

Please Log in or Create an account to join the conversation.

More
12 years 8 months ago #139050 by davec
Replied by davec on topic Re: PDF invoice
Out of interest does this plugin just attach a PDF version of what is already in Hikashop as an invoice, is there an example of what the PDF looks like?

Thanks

Dave B)

Please Log in or Create an account to join the conversation.

More
12 years 8 months ago #139070 by Mohamed Thelji
Replied by Mohamed Thelji on topic PDF invoice
Hi Dave,
Note that you can directly test it through the back-end of the Hikashop demo website, and :
- Go to the page "Hikashop->Orders" and edit one of the existing orders
- Use the Invoice button then a pdf file will be downloaded
Note that the display of the PDF invoice is customizable through the file: "plugins/hikashop/attachinvoice/attachinvoice/invoice.php".

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #162263 by TorstenL
Replied by TorstenL on topic PDF invoice
Hi all,

does the PDF-plugin also work with the multivendor option ? Means, will the address and the logo of the vendor appear in the PDF ?

Best regards
Torsten

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #162269 by lousyfool
Replied by lousyfool on topic PDF invoice
It's a PHP script, so pretty much anything is possible even if not set yet, provided it's in the database and on file, and a bit of code. You might need or want to re-style, anyway.
As I said elsewhere before, the PDF Invoice Plugin is one of the better investments I've made in the course of my current project. And Jerome (for HikaMarket particularly) and the other boys here are ultimately helpful. (Hint: When it's the time, best post in the relevant forums, not here in the archives. ;) )

Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Last edit: 12 years 2 months ago by lousyfool.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #162302 by nicolas
Replied by nicolas on topic PDF invoice
Hi,

By default, it's not the logo/address of the vendor which is displayed in the PDF invoice of that plugin. But as lousyfool points out, it can be changed in the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php
Now I'm not the specialist on HikaMarket, so if you need more details on what to put in order to get the data from HikaMarket, I would recommend to that you open a new thread in the HikaMarket section of the forum where Jerome will be able to answer you about that.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #162811 by TorstenL
Replied by TorstenL on topic PDF invoice
Many thanks, guys, for the update. I will post it in the forum.

Please Log in or Create an account to join the conversation.

Time to create page: 0.375 seconds
Powered by Kunena Forum