Ability to download files from the product page after ordering

  • Posts: 410
  • Thank you received: 15
4 years 11 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: 4486
  • Thank you received: 609
  • MODERATOR
4 years 11 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: 410
  • Thank you received: 15
4 years 9 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: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 9 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: 410
  • Thank you received: 15
4 years 9 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: 4 years 9 months ago by neo191987.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 9 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: 4 years 9 months ago by nicolas.
The following user(s) said Thank You: neo191987

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

Time to create page: 0.079 seconds
Powered by Kunena Forum