Jump to content

How can the customer download his invoice instead of see it?


Recommended Posts

Hi there,

 

I would like know how can the customer download his invoices from his account in order-detail instead of see it. I prefer that the customer can download directly when he click in PDF how worked in PS 1.4

 

What is the url for donwload it directly?

 

best regards

Link to comment
Share on other sites

Since it is a pdf and most people have acrobat installed they will download. You can put a msg tellingthe person to right click on the pdf and click save as. Or you can write a php script that will make the file download.

Link to comment
Share on other sites

Yes, i need download it from history page (order-detail.tpl)

the link to modify is:

<a href="{$link->getPageLink('pdf-invoice', true)}?id_order={$order->id|intval}{if $is_guest}&secure_key={$order->secure_key}{/if}">{l s='Download your invoice as a PDF file'}</a>

best regards

Edited by seog (see edit history)
Link to comment
Share on other sites

This is just an off the cuff without testing it out, but it should put you on the right path.

 

Make a file called downloader.php, have this as the content

<?php
header('Content-disposition: attachment; filename='+ $invoicenumber);
header('Content-type: application/pdf');
readfile($invoicenumber);
?>

 

Then change your template code to something like

 

<a href="http:yoursite.com/downloader.php?invoicenumber={$link->getPageLink('pdf-invoice', true)}?id_order={$order->id|intval}{if $is_guest}&secure_key={$order->secure_key}{/if}">{l s='Download your invoice as a PDF file'}</a>

Link to comment
Share on other sites

Thanks for your code, I tested it but the file don´t work, I think the code {$link->getPageLink('pdf-invoice', true)} take the main domain (http://www.mywebsite.com/)

 

when i click then redirects to duplicate url:

 

http://www.mywebsite.com/downloader.php?invoicenumber=http://www.mywebsite.com/index.php?controller=pdf-invoice?id_order=4

 

 

best regards

Edited by seog (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...