import product from csv, but no images

I have a problem with import products to my site using a csv file. Everything seems to work fine because al the products apear but the images fails. First i added one product to the shop with everything in it, also the images (thumb and detailed).

Then i exported the product to a csv file to know how the file looks like for an example. After that i deleted the product from the shop. I uploaded the image again exactly to the path in my exported csv file, cmod to 777 .Then i used the same csv file to import the product again. No errors during import but no image!

I read some other topics with the same problem, but cannot find real solutions.



Louwie

cs-cart 1.3.5 sp2

i used the 30 days support :smiley:

they gave me the solution, so im happy now!



:mrgreen:

Can you please post your solution here? I have the same problem with a large number of imports.



Thanks :slight_smile:

Hi Cheebs…

I will place the solution later, i am at work now.

bye…

cheebs,



It’s hard to say something exact without looking though the data you are trying to import. Can you cut’n’paste a few rows of your file?

just a bit patience :wink:

i know what cheebs is talking about and have the solution, i will place it in a vew hours…

Hi



Have you had chance to post changes yet?



Barryh

here is the solution :wink:



In order to resolve this problem please try to replace the following part of code in the “fn_common.php” file in the “core” directory of your CS-Cart installation:



```php function fn_get_server_data($val)

{

global $var_dir;



$tmp = fn_stripslashes($val);



$val = array();

$val[‘name’] = basename($tmp);

$val[‘path’] = fn_normalize_path(CSCART_DIR .DS. $tmp);

$tempfile = fn_create_temp_file();

copy($val[‘path’], $tempfile);

$val[‘path’] = $tempfile;

$val[‘size’] = filesize($val[‘path’]);

return $val;

} ```



with this one:



```php function fn_get_server_data($val)

{

global $var_dir;



$tmp = fn_stripslashes($val);



$val = array();

$val[‘name’] = basename($tmp);

$val[‘path’] = fn_normalize_path(CSCART_DIR .DS. $tmp);

$tempfile = fn_create_temp_file();

copy($val[‘path’], $tempfile);

clearstatcache();

$val[‘path’] = $tempfile;

$val[‘size’] = filesize($val[‘path’]);

return $val;

} ```



and replace the following part of code:



```php }

function fn_get_last_key(&$arr, $fn = ‘’, $is_first = false)

{ ```



with this one:



```php }

function fn_get_local_data($val)

{

global $var_dir;

static $cache = array();

if (!isset($cache[$val[‘path’]])) { // cache file to allow multiple usage

$tempfile = fn_create_temp_file();

if (move_uploaded_file($val[‘path’], $tempfile) == true) {

$cache[$val[‘path’]] = $tempfile;

} else {

$cache[$val[‘path’]] = ‘’;

}

}

if (defined(‘KEEP_UPLOADED_FILES’)) {

$tempfile = fn_create_temp_file();

copy($cache[$val[‘path’]], $tempfile);

clearstatcache();

$val[‘path’] = $tempfile;

} else {

$val[‘path’] = $cache[$val[‘path’]];

}

return $val;

}



function fn_get_last_key(&$arr, $fn = ‘’, $is_first = false)

{ ```



replace the following part of code:



```php $filtered[$id] = fn_stripslashes($udata_local[$id]); ```



with this one:



```php $filtered[$id] = fn_get_local_data(fn_stripslashes($udata_local[$id])); ```



and replace the following part of code:



```php if (ini_get(‘allow_url_fopen’) == true) { ```



with this one:



```php if (fn_get_ini_param(‘allow_url_fopen’) == true) {

```



Save the file.



And also replace the following part of code in the “products.php” file in the “include/admin” directory of your CS-Cart installation:



```php if ($mode == ‘do_m_override’) {

sess_register(‘products_ids’);

// Update multiple products data

if (!empty($products_ids)) {



$product_data = !empty($override_products_data) ? fn_check_table_fields($override_products_data, $db_tables[‘products’]) : array();

$product_descriptions = !empty($override_products_description) ? fn_check_table_fields($override_products_description, $db_tables[‘product_descriptions’]) : array();

if (isset($product_data[‘timestamp’])) {

$product_data[‘timestamp’] = fn_get_date_from_htmlselectdate($product_data[‘timestamp’]);

}

foreach ($products_ids as $p_id => $_o) { ```



with this one:



```php if ($mode == ‘do_m_override’) {

sess_register(‘products_ids’);

// Update multiple products data

if (!empty($products_ids)) {



$product_data = !empty($override_products_data) ? fn_check_table_fields($override_products_data, $db_tables[‘products’]) : array();

$product_descriptions = !empty($override_products_description) ? fn_check_table_fields($override_products_description, $db_tables[‘product_descriptions’]) : array();

if (isset($product_data[‘timestamp’])) {

$product_data[‘timestamp’] = fn_get_date_from_htmlselectdate($product_data[‘timestamp’]);

}

fn_define(‘KEEP_UPLOADED_FILES’, true);

foreach ($products_ids as $p_id => $_o) { ```



Save the file.



And try to export products again

Export your catalogue from admin, that will give you a wealth of knowledge to what and where your images are, I also uploaded all the images to the server and linked them from there…

[quote name=‘DIZZYMOTHER’]Export your catalogue from admin, that will give you a wealth of knowledge to what and where your images are, I also uploaded all the images to the server and linked them from there…[/QUOTE]



of course there’s a lot of information in it, but this is a bug in 1.3.5 sp2 i think, because cs-cart support gave me the solution right away!

This STILL isn’t fixed in SP3.

But some of the php code do not match to the solution (I have downloaded sp3 just recently, the fn_common.php file last edited on 8th of April).

Has this been fixed yet? I tried and tried…and tried… still no go. I know what i’m doing.

bump. I’d lke to use this software but with thousands of products I need images!

[quote name=‘ryans’]bump. I’d lke to use this software but with thousands of products I need images![/QUOTE]

I spent many hours on this one issue and I was able to import only when I added the complete path in the excel sheet. Not sure why since path is in admin backend. If you haven’t prepared the excel sheet you can do an export from the sample products (pc’s etc), grab the top headers and start with that as a perfect sample. Follow the syntax exactly on the header. I spent an hour and typed the word Product "C"ode with CAPS and it only imported with Product code (lower case). On 1.35SP3. Not sure if this helps you.

I also ftp the pictures just as DIZZYMOTHER mentioned above and connected them there.



“Export your catalogue from admin, that will give you a wealth of knowledge to what and where your images are, I also uploaded all the images to the server and linked them from there…”

[quote name=‘AJCABRERA’]I spent many hours on this one issue and I was able to import only when I added the complete path in the excel sheet. [/QUOTE]



You rock man. That worked. Thanks!

Hi.



I tryied the solutions for the images but i am still confused.

There is a big problem with CS-cart and i cant understand why its so hard to link the images for the products.



i am trying to import a store with 7500 products.



First thing is that is ipossible to import more than 1000 products at once on a full csv so i have to cut thme to pieces.



Second is that the procedure for linking the photos is a bit silly

lets see if i undertand corect.


  1. We must upload all the photos 7500 photos to a dir lets say the dafault dir wich is images/backup




  2. I have to made the excel pointing at this path okey with this thtas is not problem.

    The silly things starts now.





    why the cs-cart MUST create new Images?? giving names like 123864hddas8764423424.jpg ???



    why the cs-cart cann’t just have the link on this folder?

    How can i have my One Thumnails without cs-cart creating new ones?

    How so many Logs and Dir Thousand of them after importing a CSV file to the server?





    why cant jus be easy enough like the rests for to Import the most Important Thing the Images!!!





    maybe i am doing somthing wrong.

    maybe i find out the next 30 days which i will have support

    maybe i never learn

    but i cant any more spending Hours and Hours for Debuging the product.



    Does there is any product like Ver 1.0.0.0.0 or something like that with Minus features But With well working Functions?



    the funny thing is that only when i get warnings the images are importing if the script says OK updated then nothing happen.





    if any one has a clever way to Import Images please let me now.

    if it was me i could do something easy



    Suppose $code is the product code

    Then i will had a directory like Images_small

    and inside there i will have all my $codes.JPG

    and then just using



    No Queries

    No Lagging

    No time waste.





    Warning: unlink(C:\Inetpub\vhosts\aquaclubdesign.gr\httpdocs\var\compiled\cst4127.tmp) [function.unlink]: Permission denied in C:\Inetpub\vhosts\aquaclubdesign.gr\httpdocs\core\fn_images.php on line 84



    Does anyone knows what is this error?

well i think i found the problem.

in all these errors.





senario:



i have 10 code products Unique names but 4 of my product codes they have the some picture lest say myimage1.jpg



so



code1 , myimage1.jpg

code2 , myimage1.jpg

code3 , myimage2.jpg

code4 , myimage3.jpg

code5 , myimage4.jpg

code6 , myimage1.jpg

code7 , myimage5.jpg

code8 , myimage1.jpg





if you have setup the database images mode then there is no problem,

but if you have set it to System Files look what is going on.



cs-cart imports the first profduct and its reads the images stored in the place images/bakcup after creates the file myimage098675678806785.jpg in the folder images/detailed_images and then is renaming the file to the filename myimage1.jpg





afterwards is trying to import the next image and store it with the corect name but the FILE ALREADY exists.

so the script cannt rename the temporary file to the new file with the name image1.jpg and its leaving the temporary file in the database and there is the problem.







any idea?





what i done is clean all my images

chaneg the mode to database stored

then import all my files in there

and today i hope with some luck to export the images and have it corect all in the shop.