Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

document download link in page


Recommended Posts



This may be well simple but want to know what the best way to do it is for os commerce.


Basically i have a returns page for goods and want to create a document link that when the person wants to return an item they click and can print off the created document.


So a) how do i do the link.

and B) where do i put the document. can i create a new folder called docs say and then link to there.


Anyone know a better way! any ideas i will be up till 4am.

Link to comment
Share on other sites

Place the document anywhere you want ... then link to it using your tep_href_link function


for instance you can place your documents as you said in a folder called docs (lets say your document is called returns.doc)


then you can link to the file like so:

<?php echo '<a href="' . tep_href_link(DIR_WS_DOCS . 'returns.doc') . '">Returns document</a>'; ?>


BUT then you need to add this in your /includes/configure.php file ANYWHERE before the closing ?>


define('DIR_WS_DOCS', 'docs/');


So then you can place all your documents in this folder docs and link to them using the tep_href_link function i showed you above and simply changing the filename to the doc you want to link to (returns.doc in above example) and what you want to be displayed to the browser (Returns document in above example)




Link to comment
Share on other sites

wow, ultra fast reply and spot on. thanks ever so much. this worked a treat for anyone else wanting to know how to do this.


You have made a lady very happy, been searching for ages.


Thanks again.



Link to comment
Share on other sites

quick question how could i get it so that it opens in a fresh window. i know html its the _blank command. but php i dont know.


<?php echo '<a href="' . tep_href_link(DIR_WS_DOCS . 'returns.doc') . '" target="_blank">Returns document</a>'; ?>


opens in a new window



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...