Ability to download files from the product page after ordering

  • Posts: 429
  • Thank you received: 19
5 years 8 months ago #305713

-- HikaShop version -- : 4.0.3

Hi,
I have an idea, I do not know if you will like it or it can be realized. I think it will be more convenient for you to be able to download the files on the product page after the purchase of a product, as in the free files. This will allow for easier integration for selling audio and video that require them to appear directly on the product page.

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

  • Posts: 4763
  • Thank you received: 647
  • MODERATOR
5 years 8 months ago #305732

Hello,

Your feature is a good one ! We are going to think about our idea and his integration, how to proceed etc...
Thanks for your suggestion !

Regards

The following user(s) said Thank You: neo191987

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

  • Posts: 429
  • Thank you received: 19
5 years 6 months ago #307435

Hi, is there a way to take $file->download_link in listing_img_title. I want to generate the download address in both cases for free and paid files so I can integrate an audio player.

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
5 years 6 months ago #307443

Hi,

The files of products are not loaded on the listings. You would first need to run a MySQL query on the hikashop_file table to load the files of the product before you could generate the download link similarily to what's done on the product page. So it's possible, but it's not that simple. Especially for paid downloads where you need to run more MySQL queries to check the orders of the current user.

The following user(s) said Thank You: neo191987

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

  • Posts: 429
  • Thank you received: 19
5 years 6 months ago #307455

Thanks for the reply. I have another idea before I start doing this. Can I insert the view through this code?

<?php
	$this->setLayout('show_block_product_files');
	echo $this->loadTemplate();
?>

I want to ask what is the value of $ids in
$query = 'SELECT * FROM #__hikashop_order_product as op '.
'LEFT JOIN #__hikashop_order AS o ON op.order_id = o.order_id '.
'LEFT JOIN #__hikashop_product AS p ON op.product_id = p.product_id '.
'WHERE o.order_user_id = ' . $user->user_id . ' '.
'AND op.product_id IN (' . implode(',', $ids) . ') '.
'AND o.order_status IN (' . implode(',', $statuses) . ')';
$db->setQuery($query);
$orders = $db->loadObjectList('order_id');

Last edit: 5 years 6 months ago by neo191987.

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
5 years 6 months ago #307457

Hi,

You can but it won't do anything. This view file requires that the files data is already loaded before it can display it. So again, you'll have to run MySQL queries to be able to do that.

$ids there is an array of ids of products.

Last edit: 5 years 6 months ago by nicolas.
The following user(s) said Thank You: neo191987

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
7 months 2 weeks ago #360848

Philip wrote: Hello,

Your feature is a good one ! We are going to think about our idea and his integration, how to proceed etc...
Thanks for your suggestion !

Regards


Philip, have you done some thinking about that?

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
7 months 2 weeks ago #360856

Hi,

Yes. This capability was added to HikaShop a while back.
You just have to activate the setting "Purchased file download on product page" of the HikaShop configuration page.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
7 months 2 weeks ago #360901

It realy is. Thank you.
Now we can improve this. So instead of download link to show file preview. Or both.

I sell mp3 and dont want customer downloads the file. I made override in show_block_product_files with

$files[] = '<a'.$attributes.' class="hikashop_product_file_link d-none" href="' .  $file->download_link . '">' . $file->file_name . '</a><br/><audio controls><source src="' .  $file->download_link . '" type="audio/mpeg">Your browser does not support the audio element.</audio>';

Same can be done for video, pdf ... It would be realy great addition to Hikashop.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.085 seconds
Powered by Kunena Forum