Chuckie Cheese Posted April 10, 2009 Share Posted April 10, 2009 Hello, I have my products with name, quantity, reference, short desc, desc, and url images mapping images to the same domain, under the shop installation root, all of this in a .cvs file renamed as .txt then I got to Import and upload this product list, map acordingly to the proper fields using the import wizard, then I let the prestashop import do their things, it takes a while to do the import (about 40 prodcuts with 5 images each) and then it says OK, file imported ok, but no images on products... I have several questions, for instance, how many characters (field lenght) is capable the Images URL field is? Why is that although the wizard gives no error I dont see my images? images were uploaded using FTP and are on average, 600 kb each.Any ideas kindly appreciated Link to comment Share on other sites More sharing options...
Hoodgrown Posted April 10, 2009 Share Posted April 10, 2009 Here's a quick checklist1. make sure the folder that you've ftp'd the images to have the permissions set at 7772. make sure the products all have a category id number or else the images will not appear.3. make sure that in your database, products are called directly: http://www.yourstore.com/imageimports/product333.jpgAlso, you do not need to convert "csv" files to "txt" Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 10, 2009 Author Share Posted April 10, 2009 Ok, I have no cat_id yet, I´ll give it a try and will let all know...Thank You Link to comment Share on other sites More sharing options...
Hoodgrown Posted April 10, 2009 Share Posted April 10, 2009 I meant to say "product id".. not category id... Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 10, 2009 Author Share Posted April 10, 2009 Hi, Ivé checked the CHMOD to 777, cat_id on every product, uploaded and still no joy... Documentation good be a good thing; perhaphs the images are too heavy, perhaps the field Images URL (x, z, y) is too short to fit 255 char lenght, I don´t know why is this happening but it is frustrating and time consuming. Documentation regarding where to find the scripts that take care of the inner workings as per how to upload an image would be valuable too as I can try to make a client side desktop app to program all those task and then do it attendant-less, I have many other things to do but having myself 3 days waiting until 78 mb of images are uploaded by hand... I find amazing such a good software with such flaws... Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 10, 2009 Author Share Posted April 10, 2009 I meant to say "product id".. not category id... Is it not this an auto generated field? which format? numeric? precision? lenght? rules?¿? Where is this documentation, please?Thank you for your kind help Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 10, 2009 Author Share Posted April 10, 2009 Ok, I´ve added the product_id field and guess what? It only added 2 images from 120; we have a relatevly small catalgo, 39 products, and the cvs has 4 images per product, I´ve done the thumb regenerate routine and nothing, only 2 images are showing, the rest nothing. I´ve checked one by one, to be available as the location indicated as image URL in the cvs file and are correct, I don´t know what could be...Thanks again Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 10, 2009 Author Share Posted April 10, 2009 Ok, the issue seems to be that fields porting more than one image URL does fail; I am checking and the products indicating only one image URL does work... Since I have comas "," in many product descriptions, I am using the "|" to delimitate fields, and as file delimiter (default import wizard options) we have the "," to delimitate fileds and another stuff wich I don´t know what is it for, in spanish the translation is "file delimiter", default option ";" ehat is this for? does this has something to do PS fails to parse the content of the Image URL?¿? Any workarounds?Thank you all for your help, again! Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 10, 2009 Author Share Posted April 10, 2009 Almost solved. The translation in backoffice for spanish is wrong, it shoud say 'delimitador de campo' instead of 'delimitador de archivo' I was stating correctly the column delimiter, but not the in field delimiter... because of this wrong translation. I say 'almost solved' because it does import the cvs with products, it´s Id´s, it´s categories and the images URLs, but it happens to make only the first image thumbs, the other 2 or 3 or any above the first image is added to the db, but seems not to make the thumbs? I also done the thm remake routine, still no joy here...You can check it at www.lizzywhite.com/shop/index.phpAny advise to workaround this is appreciatedThank you Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 11, 2009 Author Share Posted April 11, 2009 I am reporting this as a BUG, anyone having this behaviour should comment on it.You can see screenshots, wich shows the behavior at this pdf I created: http://www.prestashop.com/bug_tracker/download/235The bug report is here: http://www.prestashop.com/bug_tracker/view/1707/Any comments wellcome Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 12, 2009 Author Share Posted April 12, 2009 Ok, after having no feedback from anybody, not even team members, I got into a laarge coffee jar and NuSphere, and traced down what is going on... What happens here to be *failing* (for an unknown reason to me) is this function, wich is in /admin/tabs/adminimport.php aprox line 350: private static function copyImg($id_entity, $id_image = NULL, $url, $entity = 'products') { $tmpfile = tempnam("/tmp", "ps_import"); $img = array('tmp_name' => $tmpfile); switch($entity) { default: case 'products': $path = _PS_PROD_IMG_DIR_.intval($id_entity).'-'.intval($id_image); break; case 'categories': $path = _PS_CAT_IMG_DIR_.intval($id_entity); break; } if (@copy($url, $tmpfile)) { imageResize($img, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($img, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { return false; } unlink($tmpfile); return true; } What fails exactly is this if (@copy($url, $tmpfile)) , copying the image is failing for an unkown reason, therefore it skips too the imageresize routine... If any team member can tell me why and moreover how to fix this, please?Again, please note I have 2 servers, one IIS 5.2, the other is a Linux box, in both settings, same result... so I think it is not likely to a misconfiguration /permissions issue...Please help as I am becoming a very frustrated zombie by nowThank youThank you. Link to comment Share on other sites More sharing options...
jhnstcks Posted April 12, 2009 Share Posted April 12, 2009 Have you checked other messages on the forum?Maybe you have the same proble as this thread http://www.prestashop.com/forums/viewthread/16606/installation_configuration___upgrade/importing_images Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 12, 2009 Author Share Posted April 12, 2009 Have you checked other messages on the forum?Maybe you have the same proble as this thread http://www.prestashop.com/forums/viewthread/16606/installation_configuration___upgrade/importing_images Thanks, I´ve read the thread, just to add, fopen is enabled in both servers; what I see when going step by step, stepping in into this procedure I mention is that uses tempnam function, wich behavior changed from PHP 4.x to PHP 5.X and it uses, in the case of Windows, the C:\windows\temp directory wich is an *absolute flaw* in terms of software desing; unless the SO temp folder has explicit permissions for IWAM_ and IUSR_, it will *fail* allowing writing in it... Since I dont know Linux, could be the same case? In other things, I am amazed the thread you point states that URL´s should be within quotes (remarcs a.c.a " char) why? is that true? if so, if so... PS documentation SUCKS, if not... you guys have all the community guessing out how to doelementary things like importing a stupid CVS file...Thank you Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 13, 2009 Author Share Posted April 13, 2009 Hello all, first, sorry for my ranting here but, I think I am in fair right to being ranting!First, I solved the issue, there where several thing causing it,1. The so great 'tempnam' function is sooo... cheesy. returns whatever it comes around, sometimes the OS tmp dir, sometimes the USER tmp dir, that under Windows OS, in my production server I can´t see what happens, so the fix was changing this usage of tempnam to: $var1=realpath($_SERVER['DOCUMENT_ROOT']).'\shop\_tmp'; $tmpfile = tempnam($var1, "ps_import"); That ina ddtion to creating a CHMOD 600 folder named '_tmp' in the root dir of ps, and that helped with permissions and mystery paths at all2. The so great PS documentation NEVER says the fields must be delimited by ", yes, the statement here http://www.prestashop.com/forums/viewthread/16606/installation_configuration___upgrade/importing_imagesis soo correct and documentation is sooo lousy... 3 days to figure out it must be delimited3. In the Image URL's field, curiously it says Image URL's (x, y, z) is sooo misleading that made me to put the URL´s that way, with a TRAILING SPACE BEFORE EACH OTHER like this http://one, http://two, http://three, etc and THIS TRAILING SPACE MAKES THE !copy($url, $tmpfile) to FAIL!So be clear of these, NO TRAILING SPACES between URL´S or it will fail, USE DELIMITED FIELDS, e.g. "Name" instead of just Name in your CVS file.Thank you for NOT DOCUMENTING as a result, 3 days of waste debugging.... Link to comment Share on other sites More sharing options...
first1 Posted April 13, 2009 Share Posted April 13, 2009 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, theyQuestions: 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 More sharing options...
Chuckie Cheese Posted April 14, 2009 Author Share Posted April 14, 2009 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, theyQuestions: 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 Hey first, read carefully my post, there is your solution!. All this mess is caused by the use of a function that returns temp folders, usually not granted to the web server or preprocessor identities, therefore copyimg fails consistently. The solution is as follows:Step 1. Make a new folder under the root folder where you installed, for me, that is /shop/, perhaps you installed under the root folder of your www publishing, in that case, in that same directory you create a folder and name it _tmp Then assing CHMOD (Permissions to 777)Step 2. Download the file named adminimport.php, youll find it under your /admin/tabs/ folder. Once you download it, open it in notepad or similar and go to line 350 (aprox) you will find this function private static function copyImg($id_entity, $id_image = NULL, $url, $entity = 'products') { $tmpfile = tempnam("/tmp", "ps_import"); $img = array('tmp_name' => $tmpfile); switch($entity) { default: case 'products': $path = _PS_PROD_IMG_DIR_.intval($id_entity).'-'.intval($id_image); break; case 'categories': $path = _PS_CAT_IMG_DIR_.intval($id_entity); break; } if (@copy($url, $tmpfile)) { imageResize($img, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($img, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { return false; } unlink($tmpfile); return true; } You may substitute that with this: private static function copyImg($id_entity, $id_image = NULL, $url, $entity = 'products') { [b]$var1=realpath($_SERVER['DOCUMENT_ROOT']).'\shop\_tmp';[/b] $tmpfile = tempnam($var1, "ps_import"); $img = array('tmp_name' => $tmpfile); switch($entity) { default: case 'products': $path = _PS_PROD_IMG_DIR_.intval($id_entity).'-'.intval($id_image); break; case 'categories': $path = _PS_CAT_IMG_DIR_.intval($id_entity); break; } if (@copy($url, $tmpfile)) { imageResize($img, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($img, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } unlink($tmpfile); return true; } Noteh the line in bold, you have to substitute \shop\ to \yourrootfoldername\ in case you installed on other than hosting root, if installed on hosting root, just do \_tmp This will benefit as follows:1. No more use of OS tmp folder or mistery ungranted folder at all, at least for importing images2. Correct unlink of a tmpfilename that otherwise (original code) was remaining in mistery tmp folder, causing build up.This worked for me, it was not easy to fix it, and beleive me, PS members are willing to hep but they are overloaded and theye are not going to fix your problem, so fix it yourselfHope this helps Link to comment Share on other sites More sharing options...
first1 Posted April 14, 2009 Share Posted April 14, 2009 Please note that I have linux hosting and yes i have prestashop right on the www/ (not inside another folder). you made it soo clear to understand, thank you soo much. I will try your solution now and report back. Link to comment Share on other sites More sharing options...
first1 Posted April 14, 2009 Share Posted April 14, 2009 I am getting this error after the change when i go to the import tabParse error: syntax error, unexpected '[' in /public_html/admin123/tabs/AdminImport.php on line 386That is what i have in my file now: private static function copyImg($id_entity, $id_image = NULL, $url, $entity = 'products') { [b]$var1=realpath($_SERVER['DOCUMENT_ROOT']).'\_tmp';[/b] $tmpfile = tempnam($var1, "ps_import"); $img = array('tmp_name' => $tmpfile); switch($entity) { default: case 'products': $path = _PS_PROD_IMG_DIR_.intval($id_entity).'-'.intval($id_image); break; case 'categories': $path = _PS_CAT_IMG_DIR_.intval($id_entity); break; } if (@copy($url, $tmpfile)) { imageResize($img, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($img, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } unlink($tmpfile); return true; } Link to comment Share on other sites More sharing options...
first1 Posted April 14, 2009 Share Posted April 14, 2009 Are you sure that this should work on Linux? Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 14, 2009 Author Share Posted April 14, 2009 That's because I used a bold tag inside of the code tag in the post!here is exactly what you need, copy again, copy this: private static function copyImg($id_entity, $id_image = NULL, $url, $entity = 'products') { $var1=realpath($_SERVER['DOCUMENT_ROOT']).'\_tmp'; $tmpfile = tempnam($var1, "ps_import"); $img = array('tmp_name' => $tmpfile); switch($entity) { default: case 'products': $path = _PS_PROD_IMG_DIR_.intval($id_entity).'-'.intval($id_image); break; case 'categories': $path = _PS_CAT_IMG_DIR_.intval($id_entity); break; } if (@copy($url, $tmpfile)) { imageResize($img, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($img, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } unlink($tmpfile); return true; } That, as is, no changes, copy it and replace the entire function, and give it a try, It should work now! Link to comment Share on other sites More sharing options...
Chuckie Cheese Posted April 14, 2009 Author Share Posted April 14, 2009 Hey First, also consider if the CVS is too big, you should do it splitting it into smaller files, specially if images are heavy, otherwise you´ll get 500´s cuz server timeouts. Also don´t forget to make the _tmp folder and give it CHMOD 777Please let us all know if it worked Link to comment Share on other sites More sharing options...
first1 Posted April 14, 2009 Share Posted April 14, 2009 I have only one and tried 2 products in the csv, just wnat to make it work with a couple first, so no worries about the 500 error.I removed the bold and replaced that block with what you have given me:-Imported a few time-_tmp is empty (it has 777 permissions)-/img/tmp is of course empty-/img/p does not have the pics. Where are they going? Link to comment Share on other sites More sharing options...
first1 Posted April 14, 2009 Share Posted April 14, 2009 any suggestions? Link to comment Share on other sites More sharing options...
cagrie Posted April 21, 2009 Share Posted April 21, 2009 as someone else said, only those who can walk on water can import images. imho its probably a similar monumental myth that anyone has ever accomplished.aanyways, sadly not being a saint or prophet of any kind, what i did was, I put dummy names into the image_name field (like "img1.jpg", img2.jpg") and uploaded that, as expected, thumbnails never appeared but I then went into the product and edited the dummy filenames in seperate tabs in firefox (middle button of the mouse)this semi-manual solution still saved me some time. Link to comment Share on other sites More sharing options...
first1 Posted April 21, 2009 Share Posted April 21, 2009 Sorry cargie, i did not quiet understand if you managed to get it to work, or maybe you had a workaround.Can you please tell me step by step what you did. thanks mate Link to comment Share on other sites More sharing options...
cagrie Posted April 21, 2009 Share Posted April 21, 2009 1- put image1.jpg,image2.jpg,image3.jpg into the image field.2- import the csv file3- for eg. go to the 1st product4- click "images" tab5- you'll see the image1.jpg, image2.jpg and image3.jpg with NO files6- click the "edit" button near the image name with middle mouse button. will open in new firefox tab7- edit and upload the file8- without waiting for the upload, go to the next firefox tab and edit&upload;the remaining files9- when finished, go to the "info" tab and save&go;back to categoryas I said, this I cant even claim to be a workaround, but I find this a bit easier than fresh upload of images. Link to comment Share on other sites More sharing options...
first1 Posted April 21, 2009 Share Posted April 21, 2009 so we still need to manually enter to each product and change them. it is better than nothing. Link to comment Share on other sites More sharing options...
magroot Posted May 20, 2009 Share Posted May 20, 2009 the same issue i have with my linux hosting.But once i tested PS on my localhost it worked fine and all images uploaded successfully. But online version doesn't work.I set 777 permission to all files within the folder /img it doesn't help. Probably i need to edit somewhere else, i do not know...i'll play with it and if no result i think i'll use oscommerce to edit database is easier than CSV file Link to comment Share on other sites More sharing options...
magroot Posted May 20, 2009 Share Posted May 20, 2009 agree with cagrie! this is unbelievable, more checks and instructions should be added into this CSV upload!!! Link to comment Share on other sites More sharing options...
infsistemas Posted November 6, 2011 Share Posted November 6, 2011 I have a subdomain prestashop. I replaced shop_tmp by "tmp_new" and "subdomains/my_subdomain/httpdocs/tmp_new" but no one works. Any suggestions please. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts