Jump to content

Image import issues


Recommended Posts

I have been searching all over this forum and cannot seem to find the proper way to import images during the product import. I can get all other parts of the import process to work but the images never show up.

What is supposed to be happening during the import process with the images?

Are they being copied from the URL that I supply in the import file to a sub directory in /img? Or is the URL provided in the import file where I want the images to reside? Are there specific permissions that I might be missing on some dir? I have CHMOD /img & subs and /uploads to 777.

Any help would be appreciated

Link to comment
Share on other sites

pdol,

I believe the images column in your spreadsheet should be the actual URL where your product images reside. So first, you would upload all of your product images to a directory of your choice (i.e. prestashop/prod_images). Then within your spreadsheet you would fill in the images column, for each product. (i.e. http://yourdomain/prestashop/prod_images/1234.jpg)

Here's a great tool when using spreadsheets to manage your inventory. http://www.digdb.com

Link to comment
Share on other sites

I have tried it the way you suggest and it doesn't display the image. Could some verify what the image url field in the import is for? The absolute path to the images or an interim location from where images are copied to another directory.

thanks

Link to comment
Share on other sites

There must be more to what is happening. I have tried the way you suggest and it still doesn't work. When I look to see what image it is trying to display, it shows something like: /img/p/16-16-large.jpg.

Here is what I did to test:

1. placed an image file in /img/tmp called file.jpg
2. ran the import using the proper format and in image URLs field place the full URL to the image file in /img/tmp/
3. no errors on import
4. checking the properties of the image file on the product it says /img/p/16-16-large.jpg

So is it copying/converting the file to another name. Is this by design and if so why are these files not placed into the /img/p/ directory after the import process completes. Even if I place the files myself into /img/p/ the product image refers to a different name. Something along the lines of 16-16.jpg. This I assume is the the id number followed something else.

Can someone please explaing what is supposed to be happening?

Is this basically it?

reads import file > copies image from URL in import file to another image file & places it in /img/p >

Link to comment
Share on other sites

Waiting for the next release, I patched the bug in this way and it works fine:

1) AdminImport.php ( folder /youradminfolder/tabs/ ) : add after line 477 (just after the array_walk instruction)

// if ID from csv is missing or not a number, generate a new ID from product table
if (intval($product->id)==0) $product->id = $product->getHighestIdProduct() + 1;

2) Add this function to Product.php (in /classes/ ) : add the following function

public function getHighestIdProduct()
{
$result = Db::getInstance()->getRow(’
SELECT MAX AS maxId
FROM ‘.DB_PREFIX.‘product’);
return $result[‘maxId’];
}

Now you can omit the id into csv file and images will have correct id to join the relative product.

Link to comment
Share on other sites

Dr. Benway I appreciate your posting a solution, but when I tried this it appeared to have broken my Import entirely (no error message, it just never finished). But maybe it is not your code per se but an interaction, as I had also tried the code fix suggested in:
http://www.prestashop.com/bug_tracker/view/749/

Regardless of whether I use either code modification or not, or whether I have a column for ID or not, I do not successfully retrieve the images. Am I supposed to be able to use a URL from another site, for example my current (oscommerce) website? Or does it have to be a relative URL, from within the prestashop site? If it has to be from within the prestashop directory, does it matter where I put it?

If someone who has successfully imported images could post a few rows from their csv, that might help to clear up confusion, and not only for me.

Link to comment
Share on other sites

  • 1 month later...

Hey PDOl

Not sure if your problem is solved but here is what I have done.

I have uploaded all the images to a directory and then given absolute url to the image dir : http://xuz.com.au/img/products/image001.jpg

It will auto create home,large,medium,small,thickbox and normal image per image. This will be auto generated in the P folder inside img folder. So your imported products will show on site from img/p/

Here is a sample CSV for consideration

samplepresta.csv

Link to comment
Share on other sites

  • 2 weeks later...

To Evilopinion :

I have uploaded all the images to a directory and then given absolute url to the image dir : http://xuz.com.au/img/products/image001.jpg

It will auto create home,large,medium,small,thickbox and normal image per image. This will be auto generated in the P folder inside img folder. So your imported products will show on site from img/p/


Did you tested on your local machine or on a mutual server ?
Did you tested it with upper CSV files ?

For me this works only for CSV files containing less than 9 items (9 lines) ...

Bill
Link to comment
Share on other sites

To Evilopinion :

I have uploaded all the images to a directory and then given absolute url to the image dir : http://xuz.com.au/img/products/image001.jpg

It will auto create home,large,medium,small,thickbox and normal image per image. This will be auto generated in the P folder inside img folder. So your imported products will show on site from img/p/


Did you tested on your local machine or on a mutual server ?
Did you tested it with upper CSV files ?

For me this works only for CSV files containing less than 9 items (9 lines) ...

Bill


Hi Bill,

I tested mine on both local and remote server.
I remember having a similiar issue of pnly 8 or 11 lines being imported..If I renmember correctly it had something to do with reserved words..Upload your csv and let me have a look and hopefully i can point things out.

Did you check that all your product names do not have some reserved words..Just do a quick search in here and see the words that are not allowed in your csv
Link to comment
Share on other sites

I remember having a similiar issue of pnly 8 or 11 lines being imported..If I renmember correctly it had something to do with reserved words..Upload your csv and let me have a look and hopefully i can point things out.

Did you check that all your product names do not have some reserved words..Just do a quick search in here and see the words that are not allowed in your csv


Thanks for offering some help,
my items are correctly uploaded and not with reserved words, but my problem is about images when uploading large CSV files. With upto 8 items my images are correctly displayed.
Link to comment
Share on other sites

Hi there,

I am having the same issue and spent much more than 3 days and still not working:

It is a linux hosting and the hosting guys spent huge amount of time trying to figure our why importing products as csv does not import images with them.
I have tried all the different way of writing the image path (with “” and without), no good result.

Ok here is what i have reached so far:

-Alot of files are getting created in the /img/tmp (i.e. ps_importtH7o1j) with permission set to 600
-I cant change the permissions on those new files under the tmp folder, because they were created by the php script with and owner nobody. files are not generated there.
-the img/p folder is still empty, they

Questions: why is it creating them with owner nobody? can that be changed? otherwise the have permission 600

image import in really important for me to resolve as i have thousands of images and cant do that manually. please help

Link to comment
Share on other sites

  • 5 months later...

the trick with product_id worked for me in version 1.1 unfortunately this it's a very nasty solution :

Ex :
- if you specify an existing ID - the import functionality will import two products with the same ID. I think that the product_id should be a primary key

It is a bad functionality when products already exists in database !
It seems that in version 1.2.3 -or maybe later has been fixed.

Link to comment
Share on other sites

Hi dandumit,

What you stated is totally right, that was fixed in later versions.
I use the product_id always, so I was never affected by that...

My issue above was resolved by moving to another hosting... it was my hosting that had file ownership conflict between php and httpd.

Link to comment
Share on other sites

  • 2 weeks later...

I'm having a tough time with the images too.
Have read all of the posts.

Question: In which table are these absolute URL references stored?

I'm uploading the CSV using the tool with no problem...all the product is there, but the images are not showing up.
So I started trying to locate the underlying table in MySql...searching all over.

Thanks,

Ben

Link to comment
Share on other sites

  • 2 months later...

I am having this problem as well. Have not found a solution yet, and its killing me. I am determined to use prestashop, but i am short of losing it. my csv imported fine. products are in, im trying to figure out how to setup categories as well. but my main goal is IMAGES!

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
Waiting for the next release, I patched the bug in this way and it works fine:

1) AdminImport.php ( folder /youradminfolder/tabs/ ) : add after line 477 (just after the array_walk instruction)

// if ID from csv is missing or not a number, generate a new ID from product table
if (intval($product->id)==0) $product->id = $product->getHighestIdProduct() + 1;

2) Add this function to Product.php (in /classes/ ) : add the following function

public function getHighestIdProduct()
{
$result = Db::getInstance()->getRow(’
SELECT MAX AS maxId
FROM ‘.DB_PREFIX.‘product’);
return $result[‘maxId’];
}

Now you can omit the id into csv file and images will have correct id to join the relative product.


I have now tried to make these changes, and it as seriously damaged my shop and I was just about to launch - can someone help me get it back to normal. My frontend is blank, backend works fine. I have uploaded the standard files again - AdminImport.php to my admin/tab folder and product.php to my classes folder. PLEASE! I need some good support.
Kind regards, A. Lou.
www.blaek-toner.dk/prestashop
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...