Inline Product Property Editor Web Part

The Inline Product Property Editor Web Part is a Silverlight control, hosted in an ASP.NET 2.0 Web Part. All components are deployed as part of a single wsp, and a single web part, the Inline Product Property Editor Web Part, is added to the gallery. A user with authority to modify Commerce Server product detail pages in SharePoint may place this web part on a product detail page.

The web part is usable only by SharePoint users with ManageWeb permissions. Without ManageWeb permissions, the web part neither emits content nor performs any other actions on invocation.

Integrating the Inline Product Property Editor

The Web Part accesses the properties (and variant properties) for the currently displayed product on a product details page through the Product Provider Web Part. In other words, the Inline Product Editor Web Part implements the IProductConsumer interface, and must be attached via a web part connection to the Product Provider in order to operate.

Dd464355.402cee20-0fe8-4de4-91cb-92dddec5d610(en-US,CS.90).gif

When a product details page is loaded, the Inline Product Editor Web Part receives the current product and variant properties in use on the page through the web part connection, and embeds an XML data island representing the product in the final page. Along with the XML data island, the web part also embeds:

  • The object reference for the Silverlight control

  • JavaScript necessary to launch the control, referenced via a simple link

  • A hidden html form control (type="hidden") which will receive the modified version of the data island once editing is complete

When an authorized user clicks on the Edit Product Properties link, the embedded JavaScript invokes the Silverlight control, passing the ID of the XML data island as part of the launch invocation. On launch, the Silverlight control retrieves the XML data island from the page making use of the ID passed at invocation time, parses it using Link to XML and populates an internal data representation of the product and variant information. It then overlays the visible HTML page with a translucent blanket at z-order 3 (to prevent click through to the HTML while the Silverlight control is active), and displays the Silverlight control at z-order 4.

Once the control is loaded, the user may edit properties either of the product itself, or of any variants associated with the product. The control presents two tabs – one for editing properties of the product itself, in the form of a grid, and one for editing variant properties.

Dd464355.e12213c9-30ea-4d1a-8668-0776bb3aefdc(en-US,CS.90).gif

The variant property tab contains a list of the variants of the product, as well as a variant-specific grid used to edit the variant properties. If there are no variants associated with the product, the variant tab is not displayed.

Dd464355.159efd13-eebf-4e01-9069-75fadd93d30c(en-US,CS.90).gif

Properties may be edited by double-clicking, in which case a dialog appears appropriate to the data type. The user may make changes to the data within the dialog, and click Apply to apply the changes, or Cancel to abandon them. Changed properties are denoted by a * character in the left-most column of the property display.

Dd464355.e630e8cb-13a0-47f5-a123-25d0c97ee86a(en-US,CS.90).gif

Supported dialog types are:

  • Text area

  • Number

  • Date/Time

  • Enumeration (Picker)

  • Checkbox

  • Confirmation

Once the user has finished making changes, they may click the top level Apply button to submit them. This causes the Silverlight control to:

  • Encode the internal representation of the changed product and variant data in the same XML format used for initial invocation

  • Attach the encoded data to the hidden html form field

  • Perform a Submit

When the page is loaded as a result of the Submit performed by the Silverlight control, the web part examines the hidden html form field for data. If there is data contained in the field, the web part parses it using the same mechanism as the Silverlight control, again populating an internal representation of the product and variant data. Following the parse, the web part makes a call to Commerce Server 2009 metadata to determine reverse mappings between the properties as understood by Microsoft Multi-Channel Commerce Foundation, and the properties as understood by Commerce Server Core Systems. Property names may be adjusted as a result of this operation.

Following reverse metadata mapping, the web part instantiates a connection to the Commerce Server 2009 management web services in the context of the logged in user, updates the product and variant properties changed by the user and performs a Commerce Server cache refresh. Any errors received from the Commerce Server 2009 management web service are displayed in a friendly manner by the web part. 

Once the Commerce Server update successfully completes, the web part inserts a meta-refresh tag of 2 seconds into the page header and overlays the page with a translucent blanket and an indication that processing is occurring.

Dd464355.f7d05278-3c46-4dce-a920-59bca73202b8(en-US,CS.90).gif

When the refresh occurs, the page:

  • Displays the updated product information

  • Has been displayed as a result of a HTTP GET (as opposed to an HTTP POST performed by the Silverlight control), and manual refreshes performed by the user will not re-POST the data.

Configurable Parameters

There is a single web part parameter, configurable by the page designer. This parameter indicates the URL for the Commerce Server 2009 Catalog Management Web Service, and is required. The parameter is named as follows:

Title: Commerce Server Catalog Web Service URL

Mouseover description: The URL for the Commerce Server Catalog Web Service. This is used to apply product property changes.

Default: https://localhost:55001/CatalogWebService/CatalogWebService.asmx

Dd464355.89a030f5-dd79-44e9-9dda-61188c3bb8ba(en-US,CS.90).gif

Failure to specify a valid URL will result in an error being displayed by the web part, and non-display of the Silverlight control launch link.

Dd464355.b0af8ff5-d5fb-4c2c-8a72-6eb35a3ae7d4(en-US,CS.90).gif

See Also

Other Resources

Working With the Inline Product Editor Web Part

Catalog System Web Parts