Product Details Web Part
The Product Details Web Part displays product details by using XSL transforms. This Web Part lets you create more complex formatted displays of Commerce Server 2009-based product property details derived from input criteria.
The Product Details List Web Part lets the page designer choose a list of properties to display, and an XSL transform to apply to the specified properties. Properties are retrieved from the Product Provider Web Part through a Web Part connection at page-render time. The page designer chooses the properties to display from a pop-up picker selected from the Web Part Property pane. The properties available in the picker are determined by a list maintained by the Product Controller Web Part.
The XSL Transform Template area of the property sheet looks like this:
The Product Details Web Part also supports an XSL transform supplied through an option in the Web Part Property pane:
At render time, the XSL transform is applied to the list of selected properties for display. Also, you can save the XSL transform and the list of properties as a template to a document library. This lets you upload a template that will automatically populate these values.
Architecture
The Product Details Web Part contains these components:
IProductConsumer: an interface to the base class to allow consumption of the ProductQuery connection
IXsltTemplateWebPart: an interface for the template Web Part
PropertyPicker: the property picker pop-up that you use extensively throughout these Web Parts
Properties
The following table lists the properties that you can define for Product Details List Web Part.
Property |
Type |
Description |
Default value |
---|---|---|---|
PropertyList |
String |
Semi-colon separated list of properties to retrieve. |
Empty |
VariantPropertyList |
String |
Semi-colon separated list of variant properties to retrieve. |
Empty |
XslTemplate |
String |
Name of the XSL template. Use this in a SharePoint deployment of this Web Part. |
Empty |
XslTransform |
String |
Actual transform text. Use this in a SharePoint deployment of this Web Part |
Default XSL transform |
XslTransformFilename |
String |
File name of the .xslt file to retrieve when deploying the Web Part to a standard Web page that exists outside of SharePoint. |
Empty |
Customization
The Product Details Web Part does not employ the use of a custom editor. Rather, you do all customization manually in the markup. The property names and data types are the same as in a SharePoint deployment.
Within the context of SharePoint, the Product Details Web Part is more easily customizable. The page designer alone configures the settings for the XSLT Property List. The general user has no ability to control or configure this Web Part. The page designer accomplishes this configuration through the Web Part's custom Editor Part, called XsltTemplateEditorPart. This part is accessed by the page designer through the "Modify Web Part" selection in the Edit menu of the Web Part when logged in as administrator to the site.
Clicking the "XSL Transform" button displays an editor where the page designer can edit the XSL transform directly.
Clicking the "Property Builder" button displays the standard property picker component that several other Web Parts use. The page designer can add or remove properties from the list, as well as re-order the items on the list.
In order to optimize your XSLT code, you may want to view the raw XML that is rendered before the XSL transform is applied. The following code example lets you to view the raw XML:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp><xsl:copy-of select="*"/></xmp>
</xsl:template>
</xsl:stylesheet>
Error Handling
There is no design-time error handling for this Web Part.
API Dependencies
This Web Part does not retrieve data from Commerce Server 2009; rather, it is dependent on its connection to the Product Query Web Part to retrieve this data. As a consumer of the Product Query Web Part, the Product Details Web Part must implement the [IProductConsumer] interface.