SOLVED File attachment - Open not download

  • Posts: 5
  • Thank you received: 0
10 years 2 months ago #207860

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.0
-- PHP version -- : 5.3

Hi all
I have a thing on my product view page that are bothering me.
Alle my products have several PDF files attached (Hikashop file attachment) and it works. BUT!

The problem is that, when you press the file link, the file is downloaded. :-)
I know it's supposed to download. But because all the files are PDFs, I want it to open in the browser instead.

I know that in many cases it is controlled by the user's browser settings.
In this case I believe that something in HikaShop is telling it to download instead of opening in the browser.

Any ideas how to change this?
________________________________________

Found a solution.

The problem is that HikaShop is producing a URL that masks the filetype/filename.

So I made a template override of the file where the link is created:
components/com_hikashop/views/product/tmpl/show_block_product_files.php

Put the file it in: templatename/html/com_hikashop/product/show_block_product_files.php

Edit line 35:
$fileHtml = '<a target="_blank" class="hikashop_product_file_link" href="' . hikashop_completeLink('product&task=download&file_id=' . $file->file_id.$url_itemid) . '">' . $file->file_name . '</a><br/>';

to:
$fileHtml = '<a target="_blank" class="hikashop_product_file_link" href="path to files/' . $file->file_path . '">' . $file->file_name . '</a><br/>';

Last edit: 10 years 2 months ago by kemo. Reason: SOLVED it

Please Log in or Create an account to join the conversation.

Time to create page: 0.043 seconds
Powered by Kunena Forum