Jaa


Commerce Foundation Product CommerceQuery

This query retrieves a specific product and its related items. You can use this operation to retrieve a specific product (by ID), or multiple products by using the search criteria Where clause.

Syntax

        var queryProduct = new CommerceQuery<CommerceEntity>("Product");
      

Parameters

A model search supports the following properties:

Property

Description

Id

This is the ID of the product to find. This is a mandatory search property.

CatalogId

This is the name of the catalog or virtual catalog from where to locate the product. This is a mandatory search property.

Operation Sequence Components

Operation Sequence Component

Description

CatalogEntityDiscountsProcessor

Retrieves the simple discount definitions that are related to the selected products.

ProductAncestorCategoryProcessor

Loads the ancestor categories for the product loaded in the ProductLoader.

ProductBaseCatelogRelationshipProcessor

Loads the base catalog(s) for the product loaded in the ProductLoader.

ProductCanonicalCategoryProcessor

Loads the canonical categories for the product loaded in the ProductLoader.

ProductCatelogRelationshipProcessor

If configured as commerceServerRelationshipName="CrossSell" internalRelationshipName="CrossSells", loads the CrossSell products for the product loaded in the ProductLoader. If configured as commerceServerRelationshipName="UpSell" internalRelationshipName="UpSells", loads the UpSell products for the product loaded in the ProductLoader.

ProductCommerceServerRelationshipProcessor

Loads the Commerce Server Relationships for the product loaded in the ProductLoader.

ProductInventoryItemsProcessor

Retrieves the inventory stock-keeping unit (SKU) for this product loaded in the ProductLoader if an inventory resource exists, and if a SKU is specified for this product. Evaluates each requested inventory catalog.

ProductLoader

Retrieves the product from Commerce Server by using the search criteria.

ProductParentCategoryProcessor

Loads the parent categories for the product loaded in the ProductLoader.

ProductPrimaryCategoryProcessor

Loads the primary parent category for the product loaded in the ProductLoader.

ProductRelatedCategoryProcessor

Loads the related categories for the product loaded in the ProductLoader.

ProductRelatedProductProcessor

Loads the related products for the product loaded in the ProductLoader.

Related Operation

Description

CommerceQueryRelatedItem<Catalog> (BaseCatalog)

Retrieves the containing catalog's base catalog for this product if the containing catalog is a virtual catalog. Does not support any search criterion. Model search only.

CommerceQueryRelatedItem<Catalog> (Catalog)

Retrieves the containing catalog. Does not support any search criterion. Model search only.

CommerceQueryRelatedItem<Category> (PrimaryParentCategory)

Retrieves this product's primary parent catalog if one is specified. Does not support any search criterion. Model search only.

CommerceQueryRelatedItem<Category> (AncestorCategories)

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

CommerceQueryRelatedItem<Category> (CanonicalCategories)

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

CommerceQueryRelatedItem<HierarchicalCatalogEntity> (CrossSells)

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

CommerceQueryRelatedItem<Category> (ParentCategories)

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

CommerceQueryRelatedItem<Category> (RelatedCategories)

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

CommerceQueryRelatedItem<Product> (RelatedProducts)

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

CommerceQueryRelatedItem<Variant> (Variants)

Retrieves the child's variants. Supports SearchCriteria.FirstItemIndex, SearchCriteria.NumberOfItemsToReturn, SearchCriteria.ReturnTotalItemCount, and SearchCriteria.WhereClause.

CommerceQueryRelatedItem<InventoryItem> (InventoryItems)

Retrieve this product's inventory information. This supports the ModelSearch criteria mechanism only.

Supports the following search model properties:

  • Id - Mandatory property identifying the product for which the system is returning the inventory.

  • CatalogId - Mandatory property indentifying the catalog from which to retrieve the product.

  • InventoryCatalogName - Name of the inventory catalog for which to search.

The same relationship also applies to variants. When specified in the RelatedOperations list of the variant relationship, the InventoryItem is returned for all returned variants.

CommerceQueryRelatedItem<DiscountDefinition> (DiscountDefintions)

or

CommerceQueryRelatedItem<DiscountDefinition, ModelSearch<DiscountFilter>>

(DiscountDefinitions)

Retrieves the DiscountDefinition objects that are related to the selected products. Supports the CommerceModelSearch criteria mechanism only. When a CommerceModelSearch<DisountDefinition> is specified, this is equivalent to a CommerceModelSearch<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 products are found, Microsoft Multi-Channel Commerce Foundation returns a count of 0 (zero) in the response, rather than throwing an exception.

Exceptions

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

  • FaultException<GeneralOperationFault>

Remarks

The UserUILocal specified in the RequestContext is used to determine the language in which localizable product properties will be returned. If the system does not support the language in the RequestContext, the system will use the default language for the queried categories.

See Also

Other Resources

Commerce Foundation InventoryItem

Commerce Foundation Product

Commerce Foundation Variant

CommerceQuery