Working With the Product Query Web Part
The Product Query Web Part provides flexible delivery of search results. You can use the result list to, for example, produce a full list of products in a category (complete with paging) or a view of featured products.
Note
Commerce Server 2009 has a restriction to make sure that only one Product Query or Product Provider Web Part is on the Web site page at a time. A developer can use the Extensibility Kit to remove the restriction. Open the Extensibility Kit and navigate to UI\Catalog\WebParts\ProductQuery\ProductQuery.cs to find the ThereIsOnlyOneProductProvider() method. A developer can modify this method to remove or alter the restriction.
Web Part
The following figure shows the Product Query Web Part displaying products.
The Product Query Web Part may act as a master Web Part that feeds the list of products to other Web Parts through ASP.NET Web Part connections (such as a product editing Web Part). The Product Query Web Part supports the following URL parameters:
The category name or ID
The current page of product results
Property Sheet
The following figure shows the Product Query Web Part property sheet. The Product Query Web Part property sheet lets site designers control some aspects of the Web Part's behavior and appearance. The property sheet is displayed by selecting the edit option on the Web Page (in Edit Page mode) and then selecting Modify Shared Web Part. This displays the property sheet. Expand the sections to see the relevant properties.
Properties
The following table lists the properties that you can define for the Product Query Web Part.
Property |
Type |
Description |
Default value |
---|---|---|---|
Channel |
String |
Sales channel. |
"WebChannel" |
Catalog |
String |
Name of the Commerce Server 2009 catalog from which products are retrieved. |
Blank |
"Category Id" URL Parameter |
String |
URL Query string parameter to specify the category from which this web part will obtain Commerce products. |
catalog |
"Page Number" URL parameter |
String |
URL query string parameter which may be used to specify the index of the page to display from a list of paged results. |
page |
"Sort By" URL parameter |
String |
URL query string parameter which may be used to specify the property to "sort by" when ordering displayed results. |
orderby |
"Sort Direction" URL parameter |
String |
URL query string parameter which may be used to specify the "sort direction" to be used when ordering displayed results. |
dir |
"Catalog" URL Parameter |
String |
URL query string parameter which may be used to specify the catalog from which this Web Part will obtain Commerce products. |
catalog |
Include "Cross Sells" |
Boolean |
Indicates whether to return cross-sell products for the products that are returned. |
False |
Include "Relationships" |
Boolean |
Indicates whether to return relationships for the products that are returned. |
False |
Include "Up Sells" |
Boolean |
Indicates whether to return up-sell products for the products that are returned. |
False |
Include "Variants" |
Boolean |
Indicates whether to return variants for the products that are returned. |
False |
Maximum # results per page |
Integer |
Maximum number of products that you want to return per page. |
10 |
"Sort By" options |
String |
Specifies the available sorting options using a custom Xml-based configuration. |
<SortOptionItems> <SortOption Name="ListPriceDesc" DataItem="ListPrice" AscOrder="false" DisplayText="List Price (Highest to lowest)"/> |
Page title format |
String |
Sets the text format this Web Part will use to alter the web page title. The part of this value that contains "%Category%" will be replaced by the current category's display name at run-time. |
"%Category%" to indicate that this is the value of the current catalog. |