Commerce Foundation Category CommerceQuery

This query retrieves a specific category object and its related items. The Category.Id property represents the category name.

Syntax

        var queryCategory = new CommerceQuery<CommerceEntity>("Category");
      

Parameters

This operation only supports the CommerceModelSearch search criteria with the model name Category.

Property

Description

Id

Category name to search for; Null indicates the root category.

CatalogId

Represents the name of the catalog or virtual catalog from which to locate the category. This is a mandatory search property.

SearchCriteria.WhereClause

If specified, will be included in the Commerce Server Core Systems Where clause.

Operation Sequence Components

Operation Sequence Component

Description

CategoryAncestorCategoryProcessor

Loads the ancestor categories for the category loaded in the CategoryLoader.

CategoryBaseCatalogRelationshipProcessor

If configured as commerceServerRelationshipName="CrossSell" internalRelationshipName="CrossSells", loads the CrossSell categories for the category loaded in the CategoryLoader.

If configured as commerceServerRelationshipName="UpSell" internalRelationshipName="UpSells", loads the UpSell categories for the category loaded in the CategoryLoader.

CategoryCanonicalCategoryProcessor

Loads the canonical categories for the category loaded in the CategoryLoader.

CategoryCatalogRelationshipProcessor

Loads the catalog(s) for the category loaded in the CategoryLoader.

CategoryChildCategoriesProcessor

Loads the child categories for the category loaded in the CategoryLoader.

CategoryChildProductsProcessor

Loads the child products for the category loaded in the CategoryLoader.

CategoryCommerceServerRelationshipProcessor

Loads the Commerce Server Relationships for the category loaded in the CategoryLoader.

CategoryLoader

Retrieves the category from Commerce Server Core Systems by using the search criteria.

CategoryParentCategoryProcessor

Loads the parent categories for the category loaded in the CategoryLoader.

CategoryPrepareQuery

Prepares the Commerce Server configuration option(s) for the request, introducing the opportunity for customizations such as SetJoinCondition.

CategoryPrimaryCategoryProcessor

Loads the primary parent category for the category loaded in the CategoryLoader.

CategoryRelatedCategoryProcessor

Loads the related categories for the category loaded in the CategoryLoader.

CategoryRelatedProductProcessor

Loads the related products for the category loaded in the CategoryLoader.

Related Operation

Description

CommerceQueryRelatedItem<CommerceEntity>("ChildCategories", "Category")

Retrieves the child categories for the category. This supports the ModelSearch criteria mechanism. Supports SearchCriteria.FirstItemIndex, SearchCriteria.NumberOfItemsToReturn, SearchCriteria.ReturnTotalItemCount, and SearchCriteria.WhereClause.

CommerceQueryRelatedItem<CommerceEntity>("ChildProducts", "Product")

Retrieves the products for the category. This supports the ModelSearch criteria mechanism. Supports SearchCriteria.FirstItemIndex, SearchCriteria.NumberOfItemsToReturn, SearchCriteria.ReturnTotalItemCount, and SearchCriteria.WhereClause.

CommerceQueryRelatedItem<CommerceEntity>(" AncestorCategories ", "Category")

Retrieves the ancestor categories for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>(" CanonicalCategories ", "Category")

Retrieves the canonical categories for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("CrossSells", "HierarchicalCatalogEntity")

Retrieves the cross sell items categories for the category (which can be categories or products). Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("ParentCategories", "Category")

Retrieves the parent categories for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("RelatedCategories", "Category")

Retrieves the related categories for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("RelatedProducts", "Products")

Retrieves the related products for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("BaseCatalog", "Catalog")

Retrieves the base catalog for the category. This is relevant to virtual catalogs only. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("Catalog", Catalog")

Retrieves the catalog for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("PrimaryParentCategory", "Category")

Retrieves the primary category for the category. Does not support search criterion.

CommerceQueryRelatedItem<CommerceEntity>("DiscountDefinition")

or

CommerceQueryRelatedItem<CommerceEntity>("DiscountDefinition, CommerceModelSearch<DiscountFilter> ("DiscountDefinitions"))

Retrieves the DiscountDefinition objects related to the selected categories. This supports the ModelSearch criteria mechanism only. When a ModelSearch<DisountDefinition> is specified, this is equivalent to a ModelSearch<DiscountFilter> with the following properties set:

PropertyValue
ContextName<discounts>
FilterOnAwardTrue
FilterOnConditionTrue
IncludeDiscountsWithEligibilityRequirementsTrue
IncludeDiscountsWithPromoCodesFalse
IncludeInactiveDiscountsFalse

Note   If ModelSearch<DiscountDefinition> is used, the search model must contain no properties, otherwise an exception will be thrown.

Return Value

If no categories are found Microsoft Multi-Channel Commerce Foundation, returns a count of 0 (zero) in response, rather than throwing an exception.

Exceptions

Microsoft Multi-Channel Commerce Foundation can throw the following exception during this operation:

  • FaultException<GeneralOperationFault> - Indicates an operation has resulted in an internal exception being thrown. Details are logged in the event viewer.

Remarks

The RequestContext object contains the user locale information that you use to get the catalogs in the appropriate language. If the system does not support the language in the RequestContext, the system will use the default language for the catalog(s).

See Also

Other Resources

Commerce Foundation Category

CommerceQuery