Jump to content

[Solved] PDF Attachments without Downloading


Recommended Posts

Is there anyway to change the attachment behavior in PrestaShop? By default, when a PDF is attached to a product, a "Download" tab is made, and the file is downloaded when clicked. I would prefer if instead of downloading, the PDF was opened normally. This way, for people using browsers like Google Chrome, the PDF will open within the browser, and visitors using browsers such as Internet Explorer can download it (or whatever their default browser behavior is set to do).

 

Thanks for any help.

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

Also, a related question: We have MSDS sheets for several of our products. On the product pages, we just want to call the PDFs "MSDS." However, if we name all of the PDFs "MSDS," then we can't figure out which sheet is which when adding the attachment to the product via the "Available attachments" on the product edit page. Is there anyway to overcome this issue?

Link to comment
Share on other sites

  • 1 month later...

Same problem, follow

 

I actually made another post about the same thing about a week after this one, which got answered.

 

assuming you are using PS v1.5.4.1, looks like you simply need to change the AttachmentController.php

 

from

header('Content-Disposition: attachment; filename="'.utf8_decode($a->file_name).'"');

 

to

header('Content-Disposition: inline; filename="'.utf8_decode($a->file_name).'"');

 

It would be best to do this as an override. I'm also not sure how this will react to non-PDF attachments, so you best test them before you release them to the public

 

Here's a link to the thread and the reply: http://www.prestasho...ymous_element_5

 

Hope it helps! I'll be adding [solved] to the thread title.

  • Like 3
Link to comment
Share on other sites

×
×
  • Create New...