This document provides an introduction to asset and media management in EPiServer Commerce. The EPiServer platform has an asset management system supporting generic content-based files, which is used by EPiServer products such as CMS and Commerce. Assets are made available in the Edit user interface from the Assets pane, for instance blocks and media files in CMS, and the product catalog in Commerce. Media files can be for instance images, videos and documents.
The EPiServer platform content model and asset management is described in more detail in the Content section of the EPiServer CMS Developer Guide. The Commerce-specific parts of the assets management integration are described here.
Note that some of the features described for the asset management system in CMS are not yet available for Commerce.
Asset management in Commerce
By default the new content-based asset management system with the BLOB provider model is used for adding assets to the catalog nodes and entries when manging catalogs. All files are stored in the same location as the EPiServer CMS files, providing a more unified user experience.
In a Commerce installation, products and product variants from the product catalog can be accessed from the Catalogs gadget in the Assets pane, with general support for drag and drop of content items into CMS pages and blocks. The integration is done using content type classes EPiServer.Commerce.Catalog, EPiServer.Commerce.Catalog.ContentTypes and EPiServer.Commerce.Catalog.Provider.
Configuration of asset management system
The configuration setting UseLegacyAssetSystem specifies the asset management system to be used, if set to "true" the legacy ECF asset system in Commerce Manager will be used. If the legacy ECF asset system is used, the "Assets" tab in the catalog editing UI will be removed. The setting is configured as follows in the web.config files of both the Commerce Manager and the front-end sites:
<appSettings> <add key="UseLegacyAssetSystem" value="" /> </appSettings>
Using the assets API in Commerce
- Use AssetServiceDatabase to handle save, edit, and delete to the CatalogItemAsset table. The assetKey used is now ContentGuid from EPiServer asset file.
- Use CommerceMedia and CommerceMediaCollection to store asset data on a product page.
- Use the assets migration tool (see EPiServer World) to migrate the old ECF asset system to the new EPiServer asset system.
Default asset for content
EntryContentBase and NodeContent implements IAssetContainer, which contains the property CommerceMediaCollection. All content which implements the interface IAssetContainer can contain several assets. In many cases, only one of the assets will be shown at the site. The first item in the asset collection list will be used in the UI by default. Refer to Asset URL resolver for more information.
Refer to the sections listed below for more detailed information