Thommen Posted May 6, 2024 Share Posted May 6, 2024 (edited) I have set for the link target=“_blank” Despite this (and the appropriate settings in the browser), it does not open the PDF, but downloads it to disk. How can I make the PDF open and not download? I have PS 8.1.4 Edited May 6, 2024 by Thommen (see edit history) Link to comment Share on other sites More sharing options...
Prestashop Addict Posted May 6, 2024 Share Posted May 6, 2024 Where did you change it in PS? Link to comment Share on other sites More sharing options...
Thommen Posted May 6, 2024 Author Share Posted May 6, 2024 I just want to know how to set this up in PS? Link to comment Share on other sites More sharing options...
Prestashop Addict Posted May 6, 2024 Share Posted May 6, 2024 You cannot do it in PS configuration. Link to comment Share on other sites More sharing options...
Thommen Posted May 6, 2024 Author Share Posted May 6, 2024 How to effectively enforce it? What does it depend on, besides browser settings? The only option I've seen online is target="_blank" Link to comment Share on other sites More sharing options...
Prestashop Addict Posted May 6, 2024 Share Posted May 6, 2024 il y a 5 minutes, Thommen a dit : How to effectively enforce it? What does it depend on, besides browser settings? The only option I've seen online is target="_blank" Yes this is the option but you need to change php core admin templates 😞 Link to comment Share on other sites More sharing options...
Thommen Posted May 6, 2024 Author Share Posted May 6, 2024 6 minutes ago, Prestashop Addict said: change php core admin templates Can you write something more? Link to comment Share on other sites More sharing options...
endriu107 Posted May 6, 2024 Share Posted May 6, 2024 You need to set correct Content-Type header it should be application/pdf, check also in other browser maybe issue exist in some browser only. Link to comment Share on other sites More sharing options...
Prestashop Addict Posted May 6, 2024 Share Posted May 6, 2024 You need to change src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\order_actions.html.twig Link to comment Share on other sites More sharing options...
Thommen Posted May 8, 2024 Author Share Posted May 8, 2024 (edited) I don't quite understand what the problem is. I moved from PS 1.7 to PS 8.1, and I had an image and a PDF placed in the /upload directory. For these files I had a page where the image gallery and links to the PDF were placed. It stopped working for me i.e. not being logged in I could not see the graphics and the links to the PDF did not respond. I moved the /upload directory to /img/cms/upload. I replaced the links, everything started to work smoothly even will not be logged in, but the PDF files did not open (Chrome browsers). Firefox opened PDF. Eventually (and this is strange) to open PDF I had to rewrite the page. So, I uploaded the graphics and PDF to the /img/cms/ directory (not the /img/cms/upload directory because then the PDF opening didn't work) via the file manager in PS (not via FTP|SSH). Then I had to attach the PDF to the graphics. I could afford to do this because the gallery consisted of 8 graphics. Edit I've tracked down what's messing with my installation. PS generates .htaccess, and in it we have an entry: RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L]. Also added is /upload/.htaccess (to make it work for this directory) <IfModule mod_headers.c> <FilesMatch "\.pdf$"> Header set Content-Type "application/pdf" Header set Content-Disposition "inline" </FilesMatch> </IfModule> Edited May 8, 2024 by Thommen (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now