Jump to content

Create function for PDF attachment download


spk

Recommended Posts

Hello!

 

I'm wondering if someone could explain for me how I am gonna be able to do this:

 

I want an PDF (attachment) to be able to be downloaded from the history.tpl file.

I have the function ready to check the database if a PDF exists and if it does it prints out a link to it for download. 

The function checks if the filename (same as reference of the product in this case) exists as a filename in the database (ps_attachment table) then takes the encrypted name and prints it out.

 

I now have a couple of problems, how do I assign the function to history.tpl and use the reference id in the function? 

Example: pdf_find($reference); but in smarty. 

A whole piece of code would be nice with the $smarty->assign("", "") part for the function.

 

And can I some how add ".pdf" to the encrypted file name in the ps_attachment table? Where is the function that encrypts it? Does it have to be encrypted?

 

Like this: 32113223132k1o231231.pdf

 

 

Regards, 

spk

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...