CSV import, avoid product images get stored locally.

  • Posts: 344
  • Thank you received: 3
  • Hikashop Business
11 months 2 weeks ago #279883

-- HikaShop version -- : 3.2
-- Joomla version -- : 3.8
-- PHP version -- : 7

Hikashop 3.2

So Im importing products from a CSV file and this works fine.

But I "dont" want the product image to be "stored locally".
Under "new product">In Enter image path> Store locally=NO

But when Import the products from the CSV file the image is automatically stored locally.

Here is a screenshot from a part of my csv file:



How can I avoid this.
Can I do some change in the CSV file so that the image is not stored locally, or do I need to change some code in the hikashop import settings.

Any advice...

Tnx.

Attachments:
Last Edit: 11 months 2 weeks ago by river.

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

  • Posts: 63322
  • Thank you received: 9128
  • MODERATOR
11 months 2 weeks ago #279895

Hi,

There are no options for that yet. We'll have such options for the import in the next version of HikaShop.
In the mean time, you would have to modify the code in administrator/components/com_hikashop/helpers/import.php to handle that.

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

  • Posts: 344
  • Thank you received: 3
  • Hikashop Business
11 months 2 weeks ago #279944

Ok tnx for reply
This is good news, Looking foreward to next update.

Anyway. I looked trough the file:
administrator/components/com_hikashop/helpers/import.php

And it containts 2000 lines of code:cheer:

Any advice on what I need to change in the file in order to deactivate the CSV-row "Images" so it only link and doesn't import the image ?

Tnx

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

  • Posts: 63322
  • Thank you received: 9128
  • MODERATOR
11 months 2 weeks ago #279953

Deleting that piece should help:

if(substr($image,0,7)=='http://'||substr($image,0,8)=='https://'){
					$parts = explode('/',$image);
					$name = array_pop($parts);
					$name = explode('?',$name);
					$name = array_shift($name);
					$name = urldecode($name);
					if(!file_exists($this->uploadFolder.$name)){
						$content = file_get_contents($image);
						JFile::write($this->uploadFolder.$name,$content);
					}else{
						$size = $this->getSizeFile($image);
						if($size!=filesize($this->uploadFolder.$name)){
							$name=$size.'_'.$name;
							if(!file_exists($this->uploadFolder.$name)){
								$content = file_get_contents($image);
								JFile::write($this->uploadFolder.$name,$content);
							}
						}
					}
					if(file_exists($this->uploadFolder.$name) && (filesize($this->uploadFolder.$name) > 0 || filesize($this->uploadFolder.$name) === false)){
						$product->images[$k] = $name;
					}else{
						$unset[]=$k;
					}
				}

The following user(s) said Thank You: river

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

  • Posts: 344
  • Thank you received: 3
  • Hikashop Business
11 months 2 weeks ago #279997

Excellent. It works.

Tnx a lot.

Looking forward to get this function as a part of Hikashop. :) :)

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

Time to create page: 0.084 seconds
Powered by Kunena Forum