This content is archived. See latest version here

This topic describes how to import assets in Episerver Commerce to the Episerver asset management system, using the AssetImporter command-line tool, and associate the assets with Catalog content.

Downloading the AssetImporter

  1. Go to Download Episerver Commerce 9 tools and code samples.
  2. Follow the intructions to download the appropriate package.
  3. WIthin the downloaded .zip file, unzip theEPiServer.Business.Commerce.Tools.ImportAsset file.

Using the Asset Importer

Syntax of AssetImporter command

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 to which assets will be imported. If not provided, the default is Catalogs.
  • -uselegacy (optional). Indicates whether the AssetImporter uses the legacy asset system.
  • -byasset (optional). Indicates that the file structure from the asset_folder will be kept intact for the import. When importing, the default is to create a structure with the products,  groups, and finally the assets.
  • -verbose (optional). Enables 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 with which the asset is associated, 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 is the asset sort order if the Catalog Node/Entry has more than one asset.

CSV file example:

Variation Code,Image ID

Note: When you have multiple groups in the asset folder, you only need to have one line in the CSV file. The import automatically imports files with the same name from the existing asset groups.

Importing assets as CMS-based content

In this case, Episerver Commerce uses the Episerver asset system.

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

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

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

AssetImporter <mapping_asset_file> '' <commerce_core_site_path> -mappingonly

Importing assets as legacy ECF assets

In this case, Episerver Commerce uses the ECF BLOB Provider to manage asset files and adds 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:

AssetImporter <mapping_asset_file> <asset_folder> <commerce_core_site_path> [asset_root] uselegacy
Related topics

Last updated: Dec 09, 2016