- Business Foundation
- Generating typed business foundation classes
- SQL meta-model
- Extending meta-models
- Exporting and importing meta-models
- Working with SQL Records
- Working with entity objects
- Filtering and sorting
- Business meta-model
- Product variants
- Bundles and packages
- Related entries
- Catalog events
- Commerce rendering templates
- Catalog content provider
- Assets and media
- Metadata Plus
- Order system overview
- Order manipulation
- Order processing
- Calculating orders
- Extending order classes
- Changing default implementation
- Rounding totals for different currencies
- Order notifications
- Order events
- Searching for orders
- Order object model and database diagram [Legacy]
- Order management classes [Legacy]
- Order addresses [Legacy]
- Shopping cart [Legacy]
- Checkout process [Legacy]
- Recurring orders [Legacy]
- Changing order number sequence [Legacy]
- Taxes [Legacy]
- EPiServer.Commerce.Sample guideline [Legacy]
- Scheduled Jobs
- Customizing search
- Configuring facets and filters
- Creating a search provider
- Configuring Solr search provider
- Configuring Episerver Find search provider
- Find integration
- Warehouses and inventories
- Workflows and activities
This content is archived. See latest version here.
Last updated: Oct 12 2015
Asset URL resolver
This topic describes how to display assets for catalog content using the AssetUrlResolver and the AssetContainer interface. The functionality is demonstrated in the Episerver Commerce sample site on the Assets tab for catalog content, where users can define a set of assets to display.
How it works
In many cases, you can define several asset items for a catalog item, but only one is shown on the site. By default, the first item is used in the asset collection in the catalog UI, ordered by the SortOrder property. You can change this behavior for content types. By adding a type to the AssetUrlConventions class, you can set a default group for the specific content type. Assets in this group are always more important than assets in other groups, regardless of sort order.
The GetAssetUrl method gets the default asset for content. The collection of assets is ordered by SortOrder. The first item in the list is selected, which is in the specified default group for the content. If there is no default group, or there is no asset for the default group, the first item in the list is used.
The AssetUrlConventions class can specify a default asset for a content type. The generic AddDefaultGroup(string groupName) method adds the specified group name as the default group for the generic type, which has to implement IAssetContainer.
You can have only one default group name for each specific content type. An InvalidOperationException is thrown if there are several default groups defined to be set for the same content type.
GetDefaultGroup gets the default group for the content. This method checks for the exact type, if there is a default group on that level. If there is no registered default group specified on the exact type, the method checks the base class for any default group registered on that type. The method recursively checks for a registered type until it is found, or until the base type no longer implements IAssetContainer.
- Assets and media for Commerce content