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

Page 1 of 4
How to import images in 1.5.1? 
 
mediagang
Sr. Member
 
Avatar
Total Posts:  111
Joined:  2008-01-16
Leeds UK
 

How do you know import images using the import profiles?

 
Magento Community Magento Community
Magento Community
Magento Community
 
rondata3
Jr. Member
 
Total Posts:  20
Joined:  2010-10-22
 

testing reply

 
Magento Community Magento Community
Magento Community
Magento Community
 
SimpleHelixcom
Enthusiast
 
Avatar
Total Posts:  906
Joined:  2007-08-31
Huntsville, AL
 

Hello,

As I understand it, if you’ve got a CSV that has the image field filled out, simply upload your images into /media/import, and run the CSV. Theoretically, Magento *should* import said images for you. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
misterpatrick
Member
 
Total Posts:  74
Joined:  2010-03-30
 

I was having issues with this as well. I have two testing servers set up and was exporting all products from one and importing all products into the other. If you look at the CSV or XML file you\’ll see that the the image path for all the images are in the directory they are placed in on the server you exported from. So /a/s/myimage.jpg. To import this you need to change that to /myimage.jpg and move it to /media/import as was mentioned here. You just have to make the path correct. A little annoying as it seems like if you move the entire directory structure to the import directory it should find the images, but it doesn\’t. Definitely something to fix in the next release.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bing Dicklepuss
Sr. Member
 
Total Posts:  91
Joined:  2010-07-26
 

I haven’t tried this with 1.5.0.1 but I have done it with older magento versions:

Magento stores images in media/catalog/product/

The 1st subfolder will be the 1st character of the image filename.
The 2nd subfolder will be the 2nd character of the image filename.
Note: CASE SENSITIVE.

So if your image filename is Si1234.jpg, it will be stored in media/catalog/product/S/i/ (media/catalog/product/S/i/Si1234.jpg)

BUT, when importing, Magento looks in media/import/ for the images.

So, if you want Magento to use existing images in media/catalog/product/ for new items, you need to give it directions to that location.

Instead of putting /Si1234.jpg in your image field, put /../../catalog/product/S/i/Si1234.jpg

You have to put the inital slash there.  The first dot-dot-slash takes you down from media/catalog/product/ to media/catalog/ and the next dot-dot-slash takes you down to media/

Now that you are down in the media/ folder, you just need to give it directions to your image from there.

Of course, if you are importing from one site to another, you might have a directory structure like www/mysite1/media/catalog/product/ and www/mysite2/media/catalog/product/ and so you will need to adjust for that.

Summary:

In your "image" (and other image fields), Instead of:

/
Si1234.jpg

Put
:

/../../
catalog/product/S/i/Si1234.jpg

Always start with a slash
, and adjust the number of ../ for how many levels down you need to go.  Then put the path to your image from there.
 
Magento Community Magento Community
Magento Community
Magento Community
 
dacash
Jr. Member
 
Total Posts:  2
Joined:  2011-02-16
 

Well i have made a script to make the csv for import in magento 1.5. But the problem is the image… I have put the image like this in the csv “/imagename.jpg” for the 3 image fields.

all images are put in media/import and still the system won’t import them.

I don’t get any errors so hard to trouble shoot :(

Anyone had this problem and was able to fix this? or know what to do?

 
Magento Community Magento Community
Magento Community
Magento Community
 
onthedole
Jr. Member
 
Total Posts:  6
Joined:  2008-11-25
 

Hi,

I can confirm I am seeing the same issue. I am using the same file and process I used in 1.4.2.0 and on 1.5.0.1 image import is broken during product import.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mooshi
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2009-07-25
Australia
 

same issue here on 1.5...only main image importing is working

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paul-xib
Sr. Member
 
Avatar
Total Posts:  116
Joined:  2009-02-02
The Netherlands
 

same here. previous magento versions worked fine importing thme using /image.jpg
Now nothing happens. :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
gammafx
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2010-04-25
 

Found a bug report on this issue:
http://www.magentocommerce.com/bug-tracking/issue/?issue=10829

 
Magento Community Magento Community
Magento Community
Magento Community
 
pbosch
Member
 
Avatar
Total Posts:  46
Joined:  2008-09-01
Enschede, The Netherlands
 

Facing the same problems here on Magento ver. 1.5.0.1. Anyone got a (temp) solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
DGagliardi
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-06-29
 

In the release notes of Magento 1.5.1.0-beta1 I found this fix:
“Fixed Error “Source file moving failed” on Import process, when PHP version is 5.2”

I hope this is the solution!

 
Magento Community Magento Community
Magento Community
Magento Community
 
pbosch
Member
 
Avatar
Total Posts:  46
Joined:  2008-09-01
Enschede, The Netherlands
 

Thanks, anyone tested the image importing in the new beta release ? As the above post suggested?

 
Magento Community Magento Community
Magento Community
Magento Community
 
DGagliardi
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-06-29
 

I tested it today.

The images were imported properly with the dataflow profile, but this issue has not yet been resolved for the new and better import / export system.

 
Magento Community Magento Community
Magento Community
Magento Community
 
haijerome
Member
 
Avatar
Total Posts:  44
Joined:  2010-07-19
 

I had this error “Source File moving failed !!!” and i have fixed it just now grin

NOTE : I haven’t migrated to Magento 1.5.0.1. BETA 1 Release nor upgraded my PHP 5.2.6 version to 5.3 or above.

1. Find the attached code below and add the lines indicated / preceded by ++ and uncomment the lines preceded by—

in the necessary files mentioned in the code and save your changes of course grin

Thats it. Try now with a product import and it will work like a cake.

Indexapp/code/core/Mage/ImportExport/Helper/Data.php
===================================================================
--- 
app/code/core/Mage/ImportExport/Helper/Data.php    (revision 96724)
+++ 
app/code/core/Mage/ImportExport/Helper/Data.php    (revision 102008)
@@ -
33,+33,@@
  */
 class 
Mage_ImportExport_Helper_Data extends Mage_Core_Helper_Data
 {
+    const XML_PATH_EXPORT_LOCAL_VALID_PATH 'general/file/importexport_local_valid_paths';
+
     
/**
      * Maximum size of uploaded files.
      *
@@ -42,4 +44,15 @@
     {
         return min(ini_get('post_max_size'), ini_get('upload_max_filesize'));
     }
+
+    /**
+     * Get valid path masks to files for importing/exporting
+     *
+     * @return array
+     */
+    public function getLocalValidPaths()
+    
{
+        $paths Mage::getStoreConfig(self::XML_PATH_EXPORT_LOCAL_VALID_PATH);
+        return 
$paths;
+    
}
 }
Index
app/code/core/Mage/ImportExport/Model/Import.php
===================================================================
--- 
app/code/core/Mage/ImportExport/Model/Import.php    (revision 96724)
+++ 
app/code/core/Mage/ImportExport/Model/Import.php    (revision 102008)
@@ -
358,+358,10 @@
         
}
         $sourceFile 
.= '.' $extension;
 
+        if (
file_exists($sourceFile)) {
+            unlink($sourceFile);
+        
}
+
         if (!@
rename($result['path'$result['file']$sourceFile){
             Mage
::throwException(Mage::helper('importexport')->__('Source file moving failed'));
         
}
Index
app/code/core/Mage/ImportExport/Model/Import/Adapter/Abstract.php
===================================================================
--- 
app/code/core/Mage/ImportExport/Model/Import/Adapter/Abstract.php    (revision 96724)
+++ 
app/code/core/Mage/ImportExport/Model/Import/Adapter/Abstract.php    (revision 102008)
@@ -
81,+81,@@
             
Mage::throwException(Mage::helper('importexport')->__('Source file path must be a string'));
         
}
         
if (!is_readable($source)) {
-            Mage::throwException($this->__("%s file does not exists or is not readable"$source));
+            
Mage::throwException(Mage::helper('importexport')->__("%s file does not exists or is not readable"$source));
         
}
         $this
->_source $source;
 
Indexapp/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php
===================================================================
--- 
app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php    (revision 96724)
+++ 
app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php    (revision 102008)
@@ -
274,+274,@@
      */
     protected function 
_initAttributes()
     
{
-        foreach (Mage::getResourceModel('customer/attribute_collection')->addSystemHiddenFilter() as $attribute{
+        $collection Mage::getResourceModel('customer/attribute_collection')->addSystemHiddenFilterWithPasswordHash();
+        foreach (
$collection as $attribute{
             $this
->_attributes[$attribute->getAttributeCode()= array(
                 
'id'          => $attribute->getId(),
                 
'is_required' => $attribute->getIsRequired(),
Indexapp/code/core/Mage/ImportExport/etc/config.xml
===================================================================
--- 
app/code/core/Mage/ImportExport/etc/config.xml    (revision 96724)
+++ 
app/code/core/Mage/ImportExport/etc/config.xml    (revision 102008)
@@ -
125,+125,18 @@
             </
updates>
         </
layout>
     </
adminhtml>
+    <default>
+        <
general>
+            <
file>
+                <
importexport_local_valid_paths>
+                    <
available>
+                        <
export_xml>var/export/*/*.xml</export_xml>
+                        <export_csv>var/export/*/
*.csv</export_csv>
+                        <
import_xml>var/import/*/*.xml</import_xml>
+                        <import_csv>var/import/*/
*.csv</import_csv>
+                    </
available>
+                </
importexport_local_valid_paths>
+            </
file>
+        </
general>
+    </default>
 </
config>

Regards,
Jerome Dennis D
Magento over all Customization | Magento Custom Module development | Magento Add Customer Custom Attribute on Back End | Magento PDF Invoice / Shipment / credit memo Customization
haijerome@gmail.com
+919846219974

 
Magento Community Magento Community
Magento Community
Magento Community
 
gammafx
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2010-04-25
 

Upgraded to Magento ver. 1.5.1.0-beta1 - the issue still persists. However, there is a workaround now… You can create a new import profile just for images and bring them in separately.  To do so follow the steps below:

go to System > Import/Export > Dataflow - Profiles.
Click Add New Profile.
Setup a profile and select NO for “Original Magento attribute names in first row” (see attached screenshot)
Map the fields to the ones in your CSV
Save and Run the profile with your CSV

As long as the product is already imported the image CSV can just have a sku, image, thumbnail, small_image fields.

If the product does not exist, you’ll get an error on that line.

Hope this helps someone.

Image Attachments
screenshot.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 4