- Posts: 137
- Thank you received: 2
PDF invoice
- emergentec
-
Topic Author
- Offline
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
Please Log in or Create an account to join the conversation.
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.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
You mean in the HTML version textfield?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.
But how can I get the full HTML stream, to add it to the PDF, like
Please Log in or Create an account to join the conversation.
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.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
I tried it with
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!
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Then the HTML invoice is displayed twice in the mail, which isn't really a solution.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.
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.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Please Log in or Create an account to join the conversation.
www.hikashop.com/component/hikashop/product/cid-18.html
Please Log in or Create an account to join the conversation.
Thanks
Dave
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
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.
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.
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" )
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.