Import file downloads - set free download

  • Posts: 91
  • Thank you received: 3
11 years 7 months ago #142696

Hi, my clients wants all his products to be accompanied by a free download, a brochure. So in our big CSV-import (500 products) we had a column files with the filename needed for that product. This went well. But now in Hikashop it's seems a paid download. But I want it as a free download.

I think / now the solutions should be a SQL-statement in table hikashop_file to change the value of file_free_download from 0 to 1.
But is there a way to achieve this by using CSV-import?

I would also like to know how to set the name of the download, by default it uses the filename without extension.

Last edit: 11 years 7 months ago by miracle.

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

  • Posts: 2334
  • Thank you received: 403
11 years 7 months ago #142705

Hi,

The easiest way is to use the mass action system: www.hikashop.com/support/documentation/i...massaction-form.html
it will allow you to process an action on multiple product so it will be perfect for those free products.
You can also use it to change the name of the download.

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

  • Posts: 91
  • Thank you received: 3
11 years 7 months ago #142707

That's a good idea! Does this mean it can't be done by import?

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

  • Posts: 2334
  • Thank you received: 403
11 years 7 months ago #142712

I guess it is but the mass action seems easier!
What we suggest when you want to play with CSV is to create exactly what you want in Hikashop and export it so you can see the different fields and what you should have in your own csv.

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

  • Posts: 91
  • Thank you received: 3
11 years 7 months ago #142715

I already did that :)

I can't find it in the export, so I'm looking over it or there's a little bug...

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

  • Posts: 91
  • Thank you received: 3
11 years 7 months ago #142977

I tried to get this done with the Mass Action Tool, but that seems impossible. I can change fields in the database tables hikashop_product and hikashop_price, while the actions need to be taken at the table hikashop_file.

To set all files after import to be a free download I would have to set:
file_free_download = 1 (is yes)
file_limit = -1 (is unlimited)

only for the records where file_type = file (table is used for more things)

I will now do it in phpMyAdmin, but it would be nice if this things could be done by either import or mass action tool.

SQL-statement:
UPDATE jos_hikashop_file
SET file_free_download='1',file_limit='-1'
WHERE file_type='file';

One more thing for other people that want to use a column 'files' in their import: use a complete URL to the file, including http://

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #145637

Hi,

Indeed, it's actually not possible to manage the file free download in the mass actions.
It require to join the product table with the file one.

I have added it on our TODO list.

The following user(s) said Thank You: miracle

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

  • Posts: 79
  • Thank you received: 0
10 years 7 months ago #188376

Hi,
I got the same problem. Each time I upload a product csv file, parameters for file (file_free_download & file_limit) change. Any improvement to fix that. I did not find any mass action either...

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #188491

Hi,

It don't seem that we fixed that in the product import feature, and in the mass actions this has not yet been implemented, it is still on our TODO list.

For now, a sql request will be the solution.

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

  • Posts: 79
  • Thank you received: 0
10 years 7 months ago #188684

I did sql request but i have to do that each times I upload a new file. Is there a way to keep default parameters?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #188691

Hi,

If in your csv file you only fill the file path, so to set the default value for free download to yes, please try to edit the file:
"administrator/components/com_hikashop/helpers/import.php"
And in the function _insertFiles() replace the code:

					if(is_string($file)){
						$value = array($this->db->Quote(str_replace('_',' ',substr($file,0,strrpos($file,'.')))),$this->db->Quote(''),$this->db->Quote($file),$this->db->Quote($db_type),$product->product_id,$ordering,$this->db->Quote(''),$this->db->Quote(''));
					}else{
						$value = array($this->db->Quote($file->file_name),$this->db->Quote($file->file_description),$this->db->Quote($file->file_path),$this->db->Quote($db_type),$product->product_id,(int)(@$file->file_ordering?$file->file_ordering:$ordering),$this->db->Quote($file->file_free_download),$this->db->Quote($file->file_limit));
					}
By:
					if(is_string($file)){
						$value = array($this->db->Quote(str_replace('_',' ',substr($file,0,strrpos($file,'.')))),$this->db->Quote(''),$this->db->Quote($file),$this->db->Quote($db_type),$product->product_id,$ordering,$this->db->Quote('1'),$this->db->Quote(''));
					}else{
						$value = array($this->db->Quote($file->file_name),$this->db->Quote($file->file_description),$this->db->Quote($file->file_path),$this->db->Quote($db_type),$product->product_id,(int)(@$file->file_ordering?$file->file_ordering:$ordering),$this->db->Quote($file->file_free_download),$this->db->Quote($file->file_limit));
					}
This will force the file to be free by default.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum