Make file Free download by default

  • Posts: 634
  • Thank you received: 16
11 years 20 hours ago #102335

My hikamarket user is uploading files for each product but they all get switched to "non free download" by default, and I don't see where to change this from the hikamarket side.

Can I configure all uploaded files to be "Free download" by default?

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

  • Posts: 26019
  • Thank you received: 4005
  • MODERATOR
11 years 17 hours ago #102352

Hi,

In the file "components/com_hikamarket/controllers/product.php" replace

		$product_id = JRequest::getInt('product_id', 0);
		$file_type = JRequest::getVar('file_type', 'product');
By:
		$config = hikamarket::config();
		$product_id = JRequest::getInt('product_id', 0);
		$file_type = JRequest::getVar('file_type', 'product');
And
$params->file_free_download = false;
By:
$params->file_free_download = $config->get('upload_file_free_download', false);

After that, you have to add a new entry in the table "hikamarket_config".
Open the url : "administrator/index.php?option=com_hikamarket&ctrl=config&task=sql" and use this query:
INSERT INTO #__hikamarket_config (`config_namekey`,`config_value`,`config_default`) VALUES ('upload_file_free_download',1,1);

In the next version of HikaMarket, this option would be accessible directly in the backend configuration.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: PeterChain

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

  • Posts: 1
  • Thank you received: 0
8 years 8 months ago #211573

Hi,

I want to ask you where can i find the option in the backend to make every file free for download by default? I import my products from a csv file. Or should i modify the code as you mentioned in your post.

Thank you!

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
8 years 8 months ago #211578

If you import the files, you can use the "files_free_download" column of your CSV in order to specify the value of the files during the import.
If you don't, the file is made as not "free download".
If you want to do it without having to specify the files_free_download column in your CSV, you would have to change the line:
$file->file_free_download = 0;
to:
$file->file_free_download = 1;
in the file administrator/components/com_hikashop/helpers/import.php

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

Moderators: Obsidev
Time to create page: 0.072 seconds
Powered by Kunena Forum