VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: kok on October 16, 2013, 11:28:25 AM

Title: download PDF invoices from VirtueMart frontend
Post by: kok on October 16, 2013, 11:28:25 AM
I want to provide users with possibility to download their PDF invoices from VirtueMart frontend
Tell me how to do it?
Title: Re: download PDF invoices from VirtueMart frontend
Post by: mekajames on December 07, 2014, 03:58:14 AM
Hello this is a good question?

anyone would know on how to do it please?
Title: Re: download PDF invoices from VirtueMart frontend
Post by: Adwans on May 05, 2016, 21:51:28 PM
Hello, comeone, can anybody answer?
Many folks asked about this feature, with no success, is it hard to have links to invoices, links to PDF from the frontend?  ;)
Mysterious facts...
Title: Re: download PDF invoices from VirtueMart frontend
Post by: GJC Web Design on May 06, 2016, 11:45:15 AM
well, your the 3rd in 3 years.. and it isn't so simple because the pdfs are stored above (or should be) the public html folder so it isn't a case of a simple generated link.

I have no idea if Max is considering this...
Title: Re: download PDF invoices from VirtueMart frontend
Post by: Adwans on May 06, 2016, 14:10:27 PM
Ok, let me answer myself ;) VM 3 J 3,5
If you have the order already confirmed, it is possible to use FE links to  the (recently created) invoice.
So, in orders/details.php file  - for example in template's html override folder  - add sth like this:

<div class="button" style="float:left"><a style="color:#333" target="_blank" href="index.php/en/?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=<?php echo($this->orderdetails['details']['BT']->virtuemart_order_id);?>&order_number=<?php echo($this->orderdetails['details']['BT']->order_number);?>&order_pass=aaa">Invoice in PDF</a></div>

Order pass is a dummy value here, it is not needed here, I suppose. It works only having invoice already created.
It works too:
<div class="button" style="float:left"><a style="color:#333" target="_blank" href="index.php/en/?option=com_virtuemart&view=invoice&layout=invoice&format=html&tmpl=component&virtuemart_order_id=<?php echo($this->orderdetails['details']['BT']->virtuemart_order_id);?>&order_number=<?php echo($this->orderdetails['details']['BT']->order_number);?>&order_pass=aaa">Invoice in HTML</a></div>

@GJC, not 3rd but 5 or 6th ;)
Regards Z.