Class ImportBase
Base class for different types of asset import implementations.
Inherited Members
Namespace: Mediachase.Commerce.Assets.Import
Assembly: Mediachase.Commerce.dll
Version: 13.30.0Syntax
public abstract class ImportBase
Constructors
ImportBase(String)
Initializes a new instance of the Import
Declaration
public ImportBase(string assetPath)
Parameters
Type | Name | Description |
---|---|---|
System. |
assetPath | The local file path where the files to import are present. |
Properties
AssetGroups
Gets all available asset groups.
Declaration
public string[] AssetGroups { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
The asset groups are determined by subfolders on the first level below the AssetPath. I e if you have the AssetPath set as "C:\Images" and below the folder you have "Small", "Medum", and "Large" then your asset groups will be "Small", "Medium" and "Large".
AssetPath
Gets the local file path where assets to import are stored.
Declaration
public string AssetPath { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
AssociateAssetsWithProduct(IEnumerable<AssetWrapper>, CatalogEntryDto)
Associates the assets with aproduct.
Declaration
public void AssociateAssetsWithProduct(IEnumerable<AssetWrapper> assets, CatalogEntryDto productDto)
Parameters
Type | Name | Description |
---|---|---|
System. |
assets | The imported assets to associate with product. |
Catalog |
productDto | The product that should receive the assets. |
DoImport(IEnumerable<AssetMapping>)
Does the import.
Declaration
public abstract void DoImport(IEnumerable<AssetMapping> entries)
Parameters
Type | Name | Description |
---|---|---|
System. |
entries | The entries to import. |
FullAssetPath(String[])
Gets the full path to an asset file.
Declaration
public string FullAssetPath(params string[] segments)
Parameters
Type | Name | Description |
---|---|---|
System. |
segments | The segments for the asset file. |
Returns
Type | Description |
---|---|
System. |
A correctly joined file path pointing to the asset file. |
GetProductDto(String)
Gets the DTO object for a product/variation from ECF.
Declaration
public CatalogEntryDto GetProductDto(string productCode)
Parameters
Type | Name | Description |
---|---|---|
System. |
productCode | The product code. |
Returns
Type | Description |
---|---|
Catalog |
A catalogEntryDto or null if not found. |
ValidAssetGroups(String)
Gets all valid asset groups for the asset.
Declaration
public IEnumerable<string> ValidAssetGroups(string assetName)
Parameters
Type | Name | Description |
---|---|---|
System. |
assetName | Name of the asset. |
Returns
Type | Description |
---|---|
System. |
The valid asset groups. |
Remarks
This handles the case when the mapping file (csv file) contains an entry that maps an asset to a product, but the asset file does not exist in all the different asset group folders. In that case we will only import the asset that actually exists.