X-Cart:How to export and import products with images
To export products with images
- Go to Tools > Import/Export > Export data section.
- Do you wish to export images?: Select Yes.
- Data types: Select PRODUCTS.
- Click Export.
The required CSV file is generated in X-Cart and a temporary directory containing product images is saved to <xcart_dir>/var/tmp/ directory. You can download the generated CSV file and the temp directory with images using FTP or SSH.
The exact name of the generated CSV file and the temp directory with images can be looked up in the Export packs section, for example:
10-20-2012 11:04 export_20121020_110455.csv - PRODUCTS Temporary directory for images: /u/user/public_html/xcart/var/tmp/export_20121020_110455
The product images info appear under the corresponding columns of the generated CSV file, for example:
[PRODUCTS] !THUMBNAIL;!IMAGE; T/product_thumbnail.jpg;P/product_main_image.jpg [DETAILED_IMAGES] !IMAGE; D/product_detailed_image.jpg [PRODUCT_VARIANTS] !IMAGE; W/product_variant_image.jpg
Note, the product images info consist of two parts: [image_type_subdir]/[image_filename].
Accordingly, each type of the exported product images is located in the corresponding sub-directory in the temp export directory, for example:
/u/user/public_html/xcart/var/tmp/export_20121020_110455/T/product_thumbnail.jpg /u/user/public_html/xcart/var/tmp/export_20121020_110455/P/product_main_image.jpg /u/user/public_html/xcart/var/tmp/export_20121020_110455/D/product_detailed_image.jpg /u/user/public_html/xcart/var/tmp/export_20121020_110455/W/product_variant_image.jpg
Directory where images are located: /u/user/public_html/xcart/var/tmp/export_20121020_110455
As result, the import script will take the images from the corresponding sub-directories in the temp export directory (see example above), and import these images to the corresponding sub-directories in the predefined <xcart_dir>/images directory:
/u/user/public_html/xcart/images/T/product_thumbnail.jpg /u/user/public_html/xcart/images/P/product_main_image.jpg /u/user/public_html/xcart/images/D/product_detailed_image.jpg /u/user/public_html/xcart/images/W/product_variant_image.jpg
Please also note, the above is true if the corresponding options under 'Images Location' are set to store images in the file system, otherwise the images data is imported from the temp export directory into the X-Cart database.
To import products with images
To import products with images, the CSV file must contain columns !THUMBNAIL and !IMAGE under [PRODUCTS] section.
If you want to import product detailed images and product variant images too, the CSV file must contain column !IMAGE under [DETAILED_IMAGES] and [PRODUCT_VARIANTS] sections correspondingly.
- Place the product images to be imported to a temporary directory inside X-Cart.
- On the Import/Export -> Import data page click Import options.
- Directory where images are located: enter the absolute (!) path to the directory, where you have placed the images.
- Select the required CSV file.
- Select the required delimiter.
- Click Import.
1. The simplest way to get a valid CSV file is to export a sample product with images (see the previous section for instructions on how to do that), and use the generated CSV file as a template.
Please note, the product images info in the generated CSV file consists of two parts: [image_type_subdir]/[image_filename]. Accordingly, the exported product images are located in the corresponding sub-directories in the temp directory (see examples in the previous section).
2. Use the temp directory created by the means of exporting a sample product with images (like <xcart_dir>/var/tmp/export_***) or create another temp directory (like <xcart_dir>/var/tmp/my_temp_dir), and place your new product images there.
Keep in mind, images of different types (product thumbnails, product main images, etc.) should be placed in the corresponding sub-directories (T, P, etc.) in the temp directory (see examples in the previous section).
If you are transferring product with images from one X-Cart to another, you can just download the whole temp directory with the images exported from one store (like <xcart_dir>/var/tmp/export_***), and upload it to the directory <xcart_dir>/var/tmp of another store.
3. The absolute path to the temp directory with your new product images consists of two parts: <xcart_dir>/ and var/tmp/export_*** (or var/tmp/my_temp_dir). The first part is the absolute path to the X-Cart directory. The absolute path to the X-Cart directory can be looked up on the Summary page in the Environment info section.
Also, it is possible to auto-generate product thumbnail images from the main product images being imported (in other words, generate thumbnails from the images specified in the !IMAGE column). This can be done by adding !GENERATE_THUMBNAIL column to your CSV file and specifying Y as the value of the column. The !THUMBNAIL column should be omitted in this case.
- Automated Generation of Thumbnails from Product Images by Import
- CSV Format for Various Data Types. Products
When importing data with images, old detail images in the "<xcart_dir>/images" directory are neither overwritten nor removed. How do I solve the problem?
When importing data with images, if in the target directory, e.g., images, X-Cart finds an image with the same name as the image being imported, for instance, "detailed_image_sku17.jpg", it doesn't overwrite or delete the existing image; instead, it appends a suffix like _01, _02, etc. to the image being imported. Thus, in our example, in the images directory we get a new image named "detailed_image_sku17_01.jpg".
To prevent cluttering up the images directory with diplicate images when importing data with images multiple times, please follow these simple steps:
- 1) Before importing data with new images, rename the images directory; e.g., to images_bkp.
- 2) Import the data with new images.
- This creates a new directory named images, where X-Cart will import the new images.
- 3) (Optional) Re-slice magnified images (if importing images for magnifier).
- 4) Copy the content of the images directory to the images_bkp directory (overwriting the old files).
- As a result, the old images in the target directory (images_bkp) will be overwritten by the new images from the source directory (images).
- 5) Remoave the images directory.
- 6) Rename the images_bkp directory to images.