Working with the 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 R2-based product property details derived from input criteria.

The Product Details Web Part lets the site 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 site designer chooses the properties to display from a pop-up picker window selected from the Web Part Property pane. The properties available in the pop-up picker window are determined by a list maintained by the Product Provider Web Part.

At render time, the XSL transform is applied to the list of selected properties for display. You can also 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.

The Product Details Web Part contains the following interfaces:

  • IProductConsumer. An interface to the base class to allow consumption of the ProductQuery connection.

  • IXsltTemplateWebPart. An interface for the template Web Part.

  • IWebEditable. An interface to create the property picker pop-up window that you use extensively throughout these Web Parts among other Web part property editor components (by creating an XsltTemplateEditorPart component).

Properties

The following table lists the properties that you can define for the Product Details Web Part.

Property

Type

Description

Default value

Template to Display

String

Template that displays the product’s details

Empty

Template Details

String

XSL style sheet

Empty

Save Current Template to Library

String

The name of the library in which to save the template

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 2010 deployment.

Within the context of SharePoint 2010, the Product Details Web Part is more easily customizable. The site designer configures the settings for the XSLT Property List. The general user has no ability to control or configure this Web Part. The site designer accomplishes this configuration through the Web Part's custom Editor Part, called XsltTemplateEditorPart. This part is accessed by the site 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 ellipsis button (…) displays an editor where the site designer can edit the XSL transform directly.

The following table lists the XSLT parameters that you can use to create your template.

XSLT parameter

Description

_url

URL of the site (SPWeb.Url).

_userIsSiteAdmin

A value indicating whether the user has administrative rights on the Web site including Manage SubWebs, Manage Permissions and, and Manage Web Permissions.

_userIsWebAdmin

A value indicating whether the user is a member of the administrators site group for this site.

_channel

The name of the current channel.

CurrencyCode

The currency code for the current catalog

To add custom XSLT parameters, you use the Extensibility Kit to modify the Web Part.

Clicking Select Properties displays the standard property picker component that several other Web Parts use. The site designer can add or remove properties from the list, as well as re-order the items in 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 R2; rather, it is dependent on its connection to the Product Query Web Part or to the Product Provider 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.

See Also

Other Resources

Developing with SharePoint Commerce Services

Developing with Catalog Web Parts

Product Details Web Part