Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

importing images fails
 
yourfriendllc
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2009-03-17
 

I am using the bulk importer for importing product inventory but I can’t seem to get the image fields correct.  I am not failing, and the image file location appears in the database, but no image gets shown in the store product view or list. 

I am prototyping in perl to create a tab-delimited text file for bulk import.  This is what I am doing, so correct me where I am doing it wrong, please:

sub importimage($){
        my $img 
shift;
        
my $fpath $img;
        
$fpath =~ s/[^\/]+$//;
        
my $fname $img;
        
$fname =~ s/^\Q$fpath\E//;
        
return "" if $fname eq "";
        
my $fltr substr($fname,0,1);
        
my $fltr2substr($fname,1,1);
        
mkdir $fltr if not -e $fltr;
        
mkdir "$fltr/$fltr2if not -"fltr/$fltr2";
        if(
not -"$fltr/$fltr2/$fname")
        
{
                
`wget -O "$fltr/$fltr2/$fname" "$img"`;
        
}
        
if(-"$fltr/$fltr2/$fname"){
        
`chmod 777 "$fltr/$fltr2/$fname"`;}
        
return "/home/michell5/www/store/media/catalog/product/$fltr/$fltr2/$fname";
};

...

$exchfields{$prodid}{"image"importimage($$fldref{"IMAGE_URL"});
$exchfields{$prodid}{"thumbnail"$exchfields{$prodid}{"small_image"$exchfields{$prodid}{"image"};# = $exchfields{$prodid}{"gallery"} = $exchfields{$prodid}{"media_gallery"};
$exchfields{$prodid}{"thumbnail_label"$exchfields{$prodid}{"small_image_label"$exchfields{$prodid}{"image_label""";

So, that is, I am getting the remote image url from my supplier site, downloading it to media/catalog/product/<firstletter>/<second letter>/<imagename.jpg> ... then I am setting the tab-delimited fields of my import file to in the fields named “image” and “thumbnail”.  Anything wrong yet?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Just put the images in the media/import (or is it upload) folder. Make sure the permissions are such that they can be read (644)

 
Magento Community Magento Community
Magento Community
Magento Community
 
yourfriendllc
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2009-03-17
 

Hmmm, well reading through the PHP code base, I am not getting an idea of how the actual import from the csv to the db is really being done (by the importer).  Ideally, I would be able to import directly into the database, it seems that I am missing what the code actually does to the csv fields to get them into their respective tables.  Any hints?

 
Magento Community Magento Community
Magento Community
Magento Community
 
fxchain
Member
 
Avatar
Total Posts:  40
Joined:  2009-03-01
 

This is what worked for me. I uploaded all the files in media/import then used the below .csv in System > Import\Export. No need to map any fields.

"store","websites","attribute_set","type","sku","category_ids","has_options","name","url_key","gift_message_available","meta_title","meta_description","custom_design","options_container","url_path","image","small_image","thumbnail","weight","price","description","short_description","meta_keyword","custom_layout_update","status","visibility","tax_class_id","enable_googlecheckout","color","qty","min_qty","use_config_min_qty","is_qty_decimal","backorders","use_config_backorders","min_sale_qty","use_config_min_sale_qty","max_sale_qty","use_config_max_sale_qty","is_in_stock","low_stock_date","notify_stock_qty","use_config_notify_stock_qty","manage_stock","use_config_manage_stock","stock_status_changed_automatically","special_price","special_from_date","gallery"
"admin"
,"base","Default","simple","20 P","247,232,15,10,229,243",0,"Silver Chrome",,"Use config",,,,"Block after Info Column",,"/20 P-2.jpg","/20 P-2.jpg","/20 P-2.jpg",2,38,"Deep Gray with Intricate Light Blue & White Designs","Deep Gray with Intricate Light Blue & White Designs",,,"Enabled","Catalog, Search","Taxable Goods","Yes",,1000,0,1,0,0,1,1,1,0,1,1,,,1,0,1,0,,,"/20 P-3.jpg;/20 P-4.jpg;/20 P-5.jpg;/20 P-6.jpg;/20 P-7.jpg;/20 P-8.jpg;/20 P-9.jpg;/20 P-10.jpg"
"admin"
,"base","Default","simple","21 P","15,10,149,105",0,"Red Chrome",,"Use config",,,,"Block after Info Column",,"/21 P-2.jpg","/21 P-2.jpg","/21 P-2.jpg",2,38,"Red with Intircate Black & White Designs","Red with Intircate Black & White Designs",,,"Enabled","Catalog, Search","Taxable Goods","Yes",,1000,0,1,0,0,1,1,1,0,1,1,,,1,0,1,0,,,"/21 P-3.jpg;/21 P-4.jpg;/21 P-5.jpg;/21 P-6.jpg;/21 P-7.jpg;/21 P-8.jpg;/21 P-9.jpg;/21 P-10.jpg"
"admin"
,"base","Default","simple","22 P","104,218,15,10,133,151",0,"Navy Chrome",,"Use config",,,,"Block after Info Column",,"/22 P-2.jpg","/22 P-2.jpg","/22 P-2.jpg",2,38,"Dark Navy with Intricate Yellow & White Designs","Dark Navy with Intricate Yellow & White Designs",,,"Enabled","Catalog, Search","Taxable Goods","Yes",,1000,0,1,0,0,1,1,1,0,1,1,,,1,0,1,0,,,"/22 P-3.jpg;/22 P-4.jpg;/22 P-5.jpg;/22 P-6.jpg;/22 P-7.jpg;/22 P-8.jpg;/22 P-9.jpg;/22 P-10.jpg"

Just copy and paste that into a text file and open with excel. The file attachment is not working for me on this forum.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top