Jump to content

Opening a New Window for attachments of Products


Recommended Posts

Hi, 

 

In my products, many of the have PDF attachements and MP3 files with them to download. However I want to have the option of when you click on the link, it opens it up in a new tab so you can view/play the file without downloading it.

 

Does anyone know how to do this/ know of a module that can do this?

 

Thanks, 

 

jorr19

Link to comment
Share on other sites

You'll need to modify 2 files.

 

1) Modify the file /controllers/front/AttachmentController.php

 

Find the following line header('Content-Disposition: attachment; filename="'.utf8_decode($a->file_name).'"'); and change it to header('Content-Disposition: inline');

 

2) Open the file /themes/YOUR_THEME/product.tpl

 

Find the following line <a class="btn btn-default btn-block" href="{$link->getPageLink('attachment', true, NULL, "id_attachment={$attachment.id_attachment}")|escape:'html':'UTF-8'}"> ~line 550 and change it to <a class="btn btn-default btn-block" target="_blank" href="{$link->getPageLink('attachment', true, NULL, "id_attachment={$attachment.id_attachment}")|escape:'html':'UTF-8'}">

  • Like 2
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...