This content is archived. See latest version here


This document describes how to specify items and quantities for a product package. When you configure items for a package, you will get the child relations from the parent package item Entry object. The quantities among other information, are retrieved from the CatalogEntryRelation data table.

Classes referred to here are available in the following namespaces:

How it works

The entryInstance.Entries.Entry contains the package item child entries, but they do not contain the relation information information.

The CatalogRelationDto is a DataSet with the following DataTables:

  • CatalogEntryRelation
  • CatalogItemAsset
  • CatalogNodeRelation
  • NodeEntryRelation

The CatalogEntryRelation is a DataTable with the following columns:

  • ParentEntryId
  • ChildEntryId
  • RelationTypeId
  • Quantity
  • GroupName
  • SortOrder

The Quantity field contains the quantities for the package's child entries. The CatalogContext.Current.GetCatalogRelationDto() method, called with the proper parameters, passes execution down the chain from CatalogRelationManager to CatalogRelationAdmin, where ultimately the stored procedure [ecf_CatalogRelation] is run. In that stored procedure, certain select queries are conditionally executed depending on parameters, and results are mapped in-memory to some of the DataTable objects above.

Example: a method GetPackageChildEntries() creating a List of KeyValuePair objects and adding pairs of child entry IDs and quantities from the CatalogEntryRelation DataTable.

public List<KeyValuePair<int, decimal>> GetPackageChildEntries(Entry parent)
  List<KeyValuePair<int, decimal>> childEntryQuanities = new List<KeyValuePair<int, decimal>>();

  CatalogRelationResponseGroup group = 
    new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.CatalogEntry);
  CatalogRelationDto relations = CatalogContext.Current.GetCatalogRelationDto(0, 0, parent.CatalogEntryId, string.Empty, group);

  if (relations != null && relations.CatalogEntryRelation != null && relations.CatalogEntryRelation.Count > 0)
    foreach (CatalogRelationDto.CatalogEntryRelationRow row in relations.CatalogEntryRelation.Rows)
      childEntryQuanities.Add(new KeyValuePair<int, decimal>(row.ChildEntryId, row.Quantity));

  return childEntryQuanities;

The GetCatalogRelationDto() signature is as follows, with a description on how each parameter is used in the sample above:

public CatalogRelationDto GetCatalogRelationDto(int catalogId, int catalogNodeId, int catalogEntryId, string groupName, CatalogRelationResponseGroup responseGroup)

  • catalogId: passing 0 here, do not filter by catalog.
  • catalogNodeId: passing 0 here, do not filter by catalog.
  • catalogEntryId: the catalog entry ID of the package.
  • groupName: passing empty string here, do not filter by group name, you can query the GroupName values of the CatalogEntryRelation to specify this as an additional filtering query.
  • responseGroup: passing the CatalogRelationResponseGroup.ResponseGroup.CatalogEntry enum value to specify that the corresponding select query in the ecf_CatalogRelation stored procedure be executed, and its results be mapped to the CatalogEntryRelation data table; The enum has the Flags attribute.
    ResponseGroup.CatalogNode will map execution results to CatalogNodeRelation, and ResponseGroup.NodeEntry will map execution results to NodeEntryRelation.

See also

  • Refer to the EPiServer Commerce User Guide for more information on product packages.

Last updated: Oct 21, 2014