Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
This topic describes how to specify items and quantities for a product package. When you configure items for a package, you get the child relations from the parent package item Entry object. The quantities (among other information) are retrieved from the CatalogEntryRelation data table.
Classes in this topic are in the Mediachase.Commerce.Catalog.Dto namespace.
The entryInstance.Entries.Entry contains the package item child entries, but does not contain the relation information.
The CatalogRelationDto is a DataSet with the following DataTables:
The CatalogEntryRelation is a DataTable with the following columns:
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)
Last updated: Oct 12, 2015