This content is archived. See latest version here

Last updated: Oct 21 2014

This document provides an introduction to the importing of assets in EPiServer Commerce using AssetImporter. This is a command-line tool for importing assets to the asset management system in EPiServer, and associate them with Catalog content.

Using the Asset Importer

Syntax of AssetImporter command

XML
AssetImporter <mapping_asset_file> <asset_folder> <commerce_core_site_path> [asset_root] [-uselegacy] [-byasset] [-verbose]

The command parameters

  • mapping_asset_file: a CSV file that contains mapping between products/variations and assets.
  • asset_folder: the folder that contains the assets to be imported.
  • commerce_core_site_path: the physical path of the Commerce site.
  • asset_root (optional): The name of the asset folder where the assets will be imported to, if not provided the default will be Catalogs.
  • -uselegacy (optional): flag indicating if the AssetImporter will use the legacy asset system.
  • -byasset (optional): indicates that the file structure from the asset_folder will be kept intact for the import. The default when importing is to create a structure with the products, the groups and finally the assets.
  • -verbose (optional): enable detailed logging of the asset import process.

Structure of CSV asset file

  • The first row of the file contains headers.
  • There are at least 2 columns in the file: the Catalog Node/Entry code and the asset file name. The first column is the Catalog Node/Entry code that the asset will be associated with, but if the first header contains the word 'asset', the content of the first column is interpreted as the asset file name.
  • The third column is optional. It will be the asset sort order if the Catalog Node/Entry has more than one asset.

CSV file example:

XML
Variation Code,Image ID
Jackets-Peacoats-Hooded,Jackets-Peacoats-Hooded.jpg
Jackets-Peacoats-Ruffle,Jackets-Peacoats-Ruffle.jpg
Jackets-Peacoats-Asymmetrical,Jackets-Peacoats-Asymmetrical.jpg
65990B,400x300.png
72008B,400x300.png
24215B,400x300.png
Fashion,400x300.png,0
Fashion,980x150.png,2
Fashion,980x300.png,1
Note that when you have multiple groups in the asset folder, you only need to have one line in the CSV file. The import will automatically import all files with the same name from the existing asset groups.

Importing assets as CMS-based content

In this case, EPiServer Commerce will use the EPiServer asset system.

To import using Asset Management as CMS-based content, use the following command:

XML
AssetImporter <mapping_asset_file> <asset_folder> <commerce_core_site_path> [asset_root]

If CMS already has asset-based content, use -mappingonly parameter to associate asset content with Catalog Node/Entry.

XML
AssetImporter <mapping_asset_file> '' <commerce_core_site_path> -mappingonly

Importing assets as legacy ECF assets

In this case, EPiServer Commerce is using the ECF BLOB Provider to manage the asset files and adding the asset to Catalog Node/Entry through the Asset tab in Catalog Management.

To import using the legacy Asset Management system, use the uselegacy parameter:

XML
AssetImporter <mapping_asset_file> <asset_folder> <commerce_core_site_path> [asset_root] uselegacy

See also

Refer to the sections listed below for more detailed information

  • Content section of the EPiServer CMS SDK.
  • Assets and media section of the EPiServer CMS SDK.
  • BLOB providers section of the EPiServer CMS SDK.

Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/