[Skip to main content](#vessel-content)

#   SOLVED File attachment - Open not download

##

- **[kemo](/forum/user/37931-kemo "View kemo's Profile")**
- [![kemo's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37931-kemo "View kemo's Profile") Topic Author
- [ Offline](/forum/user/37931-kemo)

Less More

- Posts: 5
- Thank you received: 0
-
-

11 years 3 months ago -  11 years 3 months ago [\#207860](#207860) by [kemo](/forum/user/37931-kemo "View kemo's Profile")  *[SOLVED File attachment - Open not download](/forum/26-product-category-display/878063-solved-file-attachment-open-not-download#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? &#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;  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&#95;hikashop/views/product/tmpl/show&#95;block&#95;product&#95;files.php  Put the file it in: templatename/html/com&#95;hikashop/product/show&#95;block&#95;product&#95;files.php  Edit line 35: $fileHtml = 'file&#95;id.$url&#95;itemid) . '&quot;&gt;' . $file-&gt;file&#95;name . '';  to: $fileHtml = 'file&#95;path . '&quot;&gt;' . $file-&gt;file&#95;name . '';")* was created by *[kemo](/forum/user/37931-kemo "View kemo's Profile")*

-- 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. ![:-)](/media/kunena/emoticons/9.png ":-)")
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 = '&lt;a target="_blank" class="hikashop_product_file_link" href="' . hikashop_completeLink('product&amp;task=download&amp;file_id=' . $file-&gt;file_id.$url_itemid) . '"&gt;' . $file-&gt;file_name . '&lt;/a&gt;&lt;br/&gt;';

to:
$fileHtml = '&lt;a target="_blank" class="hikashop_product_file_link" href="**path to files/' . $file-&gt;file\_path . '**"&gt;' . $file-&gt;file_name . '&lt;/a&gt;&lt;br/&gt;';

Last edit: 11 years 3 months ago by [kemo](/forum/user/37931-kemo "View kemo's Profile"). Reason: SOLVED it

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzgwNjMtc29sdmVkLWZpbGUtYXR0YWNobWVudC1vcGVuLW5vdC1kb3dubG9hZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.132 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
