Skip to main content

Add file for download on product page

More
15 years 5 months ago #14386 by Nikajoloem
Hi,

I'm trying to add a file for download, visible on the product page for all site visitors (so not linked to a purchase).
Can this be done through custom fields or in any other way? I can't seem to find the solution...

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

More
15 years 5 months ago #14387 by nicolas
Hi,

You can just upload the file via the joomla media manager and then add a link to it in the description of the product.

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

More
15 years 5 months ago #14390 by Nikajoloem
Isn't there another way?
I'm uploading hundreds of products through csv.

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

More
15 years 5 months ago #14399 by nicolas
You can upload all your files via FTP (for example in the media folder) and then in the description of your products, when importing your CSVs, you can specify a link : <a href=" mysite.com/media/myfile ">myfile

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

More
15 years 3 months ago #18672 by jameswadsworth
I know that the file fields in the product page is used for purchasable downloads. But could it not be adapted so that it can be used for general downloads e.g. manuals, brochures etc etc. rather than putting it in the description. May be put a tick box flag that indicates it is downloadable by anyone and does not require purchasing??

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

More
15 years 3 months ago #18673 by nicolas
It could indeed. When we can find the time to do it... :)

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

More
15 years 3 months ago #18685 by jameswadsworth
Okay I'll do it and send you what I have done.

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

More
15 years 3 months ago #18697 by nicolas
Cool ! Looking forward to that !

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

More
15 years 3 months ago - 15 years 3 months ago #18770 by jameswadsworth
Done. Now you can see a file in the product backend to 'free download' and now it appears on the front end to download. I'll send you through the changes tomorrow. Is there a function already to create a download link in hikashop. If there is can you point me in the right direction so I can tidy up the codee. Is there anything we can use from the front-end order class? Thanks
Last edit: 15 years 3 months ago by jameswadsworth.

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

More
15 years 3 months ago #18789 by nicolas
The files uploaded in the files area are stored in the the safe folder which is not directly accessible. You need to create a new controller in the product.php controller of the front end:
function download(){
$file_id = JRequest::getInt('file_id');
if(!$file_id){ return false; }
$fileClass = hikashop::get('class.file');
$fileClass->download($file_id);
return true;
}
(you also need to add that function name in the display array. Then, you can use the url :...ctrl=product&task=download&file_id=XX
but you will have to modify the function download of the file administrator/components/com_hikashop/classes/file.php in order to check if the file requested is attached to a product as a "public" file before authorizing the download for security reasons.

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

More
15 years 3 months ago #18896 by jameswadsworth
Hi Nicolas, did you get my email today. I send you through the amended files to the usual email address. Thanks

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

More
15 years 3 months ago #18897 by nicolas
I did, thanks for that !

I started looking at it but didn't had much time yet. I'll try to integrate your changes in HikaShop. On a first look, it's seems to be exactly how I was seeing it.

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

More
15 years 3 months ago #18898 by jameswadsworth
Okay perfect.

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

More
15 years 2 months ago #20679 by BRupholdt
I've added free files to several of my products but only a couple products show downloads. In some cases, I uploaded the files forgetting to check the free radio button. Then edited the file and switched it to free. It seems like this won't work unless the edit copies the file from the safe folder to the public folder?

Once I realized this, I began making sure to check the free option yet most of my products show no files. Any ideas?

I'd be glad to share login info if wanted.

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

More
15 years 2 months ago #20697 by nicolas
The files, whether they are free to download or not, are always in the safe folder.

Could you give an access to your back end so that we can check a product where it doesn't work ?

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

More
15 years 2 months ago #20732 by BRupholdt
Ahh, I misunderstood the folder use from the configuration. I've looked at the actual file structure and now understand where my confusion came from. About 20 minutes after posting, it was working. Can I assume that caching may have something to do with that? It was very odd to have it suddenly work without making any changes.

Also, where would I look to change the default for files to free? We will never sell files on this site, only use them for manuals.

BTW, thanks for the quick responses. It's so unusual to actually get help without waiting days. It's one of the reasons I went with HikaShop over Tienda.

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

More
15 years 2 months ago #20749 by nicolas
It must be a caching issue then. You should deactivate the cache plugin of joomla if you have it activated as it can't work with HikaShop since most of the pages need to be dynamic.

If you want to set it to free by default, you need to edit the file selectfile via the menu Display->Views and add the line:
<?php if(!isset($this->element->file_free_download)) $this->element->file_free_download = 1; ?>

before the line:
<?php echo JHTML::_('select.booleanlist', "data[file][file_free_download]" , '',@$this->element->file_free_download ); ?>

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

More
15 years 2 months ago #20888 by BRupholdt
Disabling cache took care of it. Thank you!

Since I don't want to edit the default pages, what do I need to do to make this change in an override page?

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

More
15 years 2 months ago #20907 by nicolas
If you do the change via the menu Display->Views, it is saved as an override in your template automatically.

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

More
15 years 2 months ago #20938 by BRupholdt
Very nice. Thank you.

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

Time to create page: 0.317 seconds
Powered by Kunena Forum