updating filepath goes wrong

  • Posts: 261
  • Thank you received: 5
10 years 2 months ago #170305

-- url of the page with the problem -- : www.artlantismedia.com
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 2.5
-- PHP version -- : ??
-- Browser(s) name and version -- : all browsers
-- Error-message(debug-mod must be tuned on) -- : No error message

Hi,

I am going to change the downloadpaths for downloadable products. That is not a hard task to do.....I thought.
- export to CSV
- Change URL of downloadpath in the ' files' field.
- Import CSV in hikashop and the changes are done.

Not so. The changes are not visible. When I check the products to see if they have a new downloadpath I see no changes. The old downloadpath is still there.
I tried several times with different products but the result is the same.

Am I doing something wrong?
I need to update thousands of products and doing this manually in hikashop is too time consuming.

Thanks in advance

Sjaak

Last edit: 10 years 2 months ago by Sjaak.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 2 months ago #170314

Hi,

Please explain with more details the modification you made, otherwise I won't be able to tell you if it's wrong or not.
A screenshot of your new configuration could help.

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.
Last edit: 10 years 2 months ago by Jerome.

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

  • Posts: 261
  • Thank you received: 5
10 years 2 months ago #170356

HI Jerome,

Thank you for your fast reply.

I added some screenshots.

Old filepath.jpg shows the original path of the downloadable file.
Old filepath in CSV.jpg shows the original filepath of the downloadable file as shown in the CSV file that was exported from hikashop.
New filepath in CSV.jpg shows the altered filepath in the new CSV file.
import CSV.jpg shows that I try to import the new CSV in hikashop.
empty screen after import.jpg shows an empty screen. I can't tell you what happens here.
Downloadpath not changed.jpg shows that the downloadpath is not altered in hikashop

The CSV file that I tried to import is a very small file containing just 80 products. The size of the file is 138kb.

I hope this helps.

Best regards

Sjaak

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #170431

Hi,

The files value in your new CSV is not OK for what you want to do.
What you did here is that you ask the import to download each file from your own website and put it directly at the root of your upload secure folder. And thus, that's why it crashes almost instantaneously as it tries to download all the files and that it quickly either fill up your PHP memory or time out after a few downloads.

Instead, you should enter only the new relative path in your CSV so that it updates the path of the files in the database and have the files moved manually via FTP to their new location in your upload secure folder.

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

  • Posts: 261
  • Thank you received: 5
10 years 2 months ago #170443

Hi Nicolas,

Thanks for your reply. Perhaps you are right and I am doing something completely wrong. What you explain is not exactly what I try to do.

This is the situation: In the near future my downloadable files will be downloaded from another server. On the other server the files are already uploaded. So now I want to tell hikashop where the files are located. The new filepaths that you see in the screenshots are filepaths on the other server. They are correct and tested. Using these URLs the files download OK.

If the method that I use is wrong,.....can you advise me another method to do this?
Thinking about your answer I would say that I first need to empty the field ' files' by importing a CSV that contains no filepaths. Then import a new CSV that contains the new filepaths on the other server. A bit of a hassle and also time consuming. Am I thinking correct or is there another method?

Thanks

Sjaak

Last edit: 10 years 2 months ago by Sjaak. Reason: correcting typo's

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

  • Posts: 261
  • Thank you received: 5
10 years 2 months ago #170447

Well I tested the method I described.
I imported a CSV file with no downloadpaths for the files.
Then checked whether the ' file' fields are empty, which they should be after that.

No avail...the original paths still where there.

I am open to new suggestions.

Sjaak

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #170455

Hi,

If you don't set anything in the files column, the files column will be ignored. So it's normal that you don't see any change.
If you don't want to have the files on your own web server, then there is no solution unless you modify the code of HikaShop.
If you put the URL via the interface, the system will indeed do what you want, but if you give the URL in your CSV, the system will first download the file and then put the name of the file in the upload secure folder.
So you would need to delete the code:

$unset = array();
			foreach($product->files as $k => $file){
				if(substr($file,0,7)=='http://'||substr($file,0,8)=='https://'){
					$parts = explode('/',$file);
					$name = array_pop($parts);
					if(!file_exists($this->uploadFolder.$name)){
						$data = @file_get_contents($file);
						if(empty($data) && !empty($this->default_file)){
							$name = $this->default_file;
						}else{
							JFile::write($this->uploadFolder.$name,$data);
						}
					}else{
						$size = $this->getSizeFile($file);
						if($size!=filesize($this->uploadFolder.$name)){
							$name=$size.'_'.$name;
							if(!file_exists($this->uploadFolder.$name)){
								JFile::write($this->uploadFolder.$name,file_get_contents($file));
							}
						}
					}
					if(file_exists($this->uploadFolder.$name) && (filesize($this->uploadFolder.$name) > 0 || filesize($this->uploadFolder.$name) === false)){
						$product->files[$k] = $name;
					}else{
						$unset[]=$k;
					}
				}
			}
			if(!empty($unset)){
				foreach($unset as $k){
					unset($product->files[$k]);
				}
			}
from the file administrator/components/com_hikashop/helper/import.php and then run the import with a CSV with the full URL to the externally hosted files and it should work fine.

The following user(s) said Thank You: Sjaak

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

  • Posts: 261
  • Thank you received: 5
10 years 2 months ago #170534

Thank you Nicolas,

This works for me.

Sjaak

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

Time to create page: 0.070 seconds
Powered by Kunena Forum