Integrating the Cross-Sell/Up-Sell Relationship Manager

The Cross-Sell/Up-Sell Relationship Manager is a Silverlight control. This feature allows you to create cross-sell and up-sell relationships between products and categories.

Integrating the Cross-Sell/Up-Sell Relationship Manager

Html environment

The Cross-Sell/Up-Sell Relationship Manager requires certain Silverlight initialization parameters and JavaScript functions. The initialization parameters can be passed directly to the component by using the "InitParams" property on the Silverlight component. If the InitParams does not specify a value, the Cross-Sell/Up-Sell Relationship Manager calls the function MSCS_GetParameter.

Script functions

The Cross-Sell/Up-Sell Relationship Manager depends on the following script functions. These should be added, either directly or via script tag link (using the "src" attribute) on any page that uses the Cross-Sell/Up-Sell Relationship Manager.

Script

Description

MSCS_GetParameter(/*string*/paramName)

This function gathers information about the current item and relationship to edit. The function will be called a few times to get various values. See Parameters used with MSCS-GetParameters for the list of valid parameter names and values.

MSCS_ShowHelp(/*string*/topicId,/*string*/fullCultureCode)

This function displays help for the topicId "MSCSCatalogItemRelationshipEditor". The script method displays help content in a way determined by the developer. The topicId and culture-code (for example, en-US) are provided to target the help to your customer base. You can implement and map topic ids as required. One option is to map the id to a URL and then display a pop-up window.

MSCS_CatalogItemRelationshipEditorClosed()

This function is called after the catalog item relationship editor window has been closed.

Parameters used with MSCS_GetParameter

The following table contains the parameter names and a description of the values returned by the MSCS_GetParameter function.

Parameter name

Expected value

Catalog

The name of the Commerce catalog to use to find the item being edited. This catalog is also used for the search function.

CatalogItemType

The type of the item being edited, This value must be either Category or Product.

CatalogItemId

The id of the catalog item being edited.

CatalogItemRelationshipToEdit

The name of the relationship to edit. This must match a Catalog relationship specified in the MetadataDefinitions.xml file.

Integration with the Business Administration Ribbon

To integrate the Cross-Sell/Up-Sell Relationship Manager with the Commerce Server Business Administration Ribbon, a configuration file must be created and must be referenced in the Commerce Server Business Administration Ribbon configuration.

Note

The instructions suggest editing files on a server. This is meant as an example only and the recommended approach is to test in a separate environment and deploy only after the changes have been approved.

To integrate the Cross Sell/Up Sell Relationship Manager with the Business Administration Ribbon

  1. Create a configuration file called "MicrosoftCommerceCatalogItemRelationship.xml" that contains the following code:

    <?xml version="1.0" encoding="utf-8" ?>
    <Plugin>
      <Context>CatalogRelationship</Context>
    <ControlName>Microsoft.Commerce.BusinessManagement.CatalogItemRelationships.Controls.PlugIn</ControlName>
      <Assembly>Microsoft.Commerce.BusinessManagement.CatalogItemRelationships.Application.dll</Assembly>
      <Xap>MicrosoftCommerceCatalogItemRelationship.xap</Xap>
    </Plugin>
    
  2. Create a server-side resources file called MicrosoftCommerceCatalogItemRelationshipResources.xaml. If you are using the Solution Storefront catalog definition, the following code is used. If your site uses different properties, you may need to alter this file as well as the UI template for the CatalogItemDisplay control:

    <ResourceDictionary
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:mCore="clr-namespace:Microsoft.Commerce.BusinessManagement;assembly=Microsoft.Commerce.BusinessManagement"
    >
    
        <mCore:StringCollection x:Key="RelationshipSearchPropertiesToReturn">
            <sys:String>DisplayName</sys:String>
            <sys:String>Image_filename</sys:String>
            <sys:String>ListPrice</sys:String>
            <sys:String>Name</sys:String>
            <sys:String>ProductCode</sys:String>
            <sys:String>Description</sys:String>
        </mCore:StringCollection>
    
    </ResourceDictionary>Copy these three files to the virtual directory of the business user web application: c:\inetpub\wwwroot\wss\virtualdirectories\[port of the business user web application or host header]
    

MicrosoftCommerceCatalogItemRelationship.xap

MicrosoftCommerceCatalogItemRelationship.xml

MicrosoftCommerceCatalogItemRelationshipResources.xaml

  1. Edit the MSCS_GetParameter function in the CommerceManagement.js file to return values for the following three parameter keys: Catalog, CatalogItemType and CatalogItemId. Your site should be prepared to make these values available in the Html mark-up, so that when the Silverlight application calls the script function, the latter is able to produce a value. Note that expecting values to be in the URL(for example, query-string parameters ) may not be sufficient if that information cannot be guaranteed to always be present.

  2. Edit the Commerce Server Business Administration Ribbon configuration file (Toolbar.xml) to add the Cross-Sell/Up-Sell Relationship Manager to its display. To edit the Commerce Server Business Administration Ribbon configuration file, find the TabItem in which you wish this module to display, and add the following:

    <controls:ToolBarModule ConfigFile="MicrosoftCommerceCatalogItemRelationship.xml" >
              <controls:ToolBarModule.InitResources>
                <ResourceDictionary>
                  <sys:String x:Key="RelationshipToEdit">CrossSells</sys:String>
                  <sys:String x:Key="OnClick">FloatSilverlight("CrossSellEditSilverlight", "/ClientBin/MicrosoftCommerceCatalogItemRelationship.xap", "CatalogItemRelationshipToEdit=CrossSells,ChannelName=,ResourceFileUris=CsManagementResources.xml MicrosoftCommerceCatalogItemRelationshipResources.xml", 10, 10, 800, 618, 800, 618, true, "App.RequestClose()")</sys:String>
                  <mCore:LocalizedValueDictionary x:Key="Label">
                    <sys:String x:Key="en-US">Cross-sell</sys:String>
                    <sys:String x:Key="en-CA">Cross-sell</sys:String>
                  </mCore:LocalizedValueDictionary>
                  <sys:String x:Key="LabelColor">Black</sys:String>
                </ResourceDictionary>
              </controls:ToolBarModule.InitResources>
            </controls:ToolBarModule>
    

Troubleshooting

The following table describes error messages and directions on how to fix the errors. If the error is not due to connectivity, the details of the error will be reported to the server by the logging system.

Message

Detail

Fix

There was an error retrieving the file MicrosoftCommerceCatalogItemRelationshipResources.xaml from the server.

This is a system configuration error.

Check that the file is downloadable and located in the same folder that the application was downloaded from.

The downloaded resource file MicrosoftCommerceCatalogItemRelationshipResources.xaml is not valid

This is a system configuration error.

1 - Verify that the MicrosoftCommerceCatalogItemRelationshipResources.xaml file contains the definition for a Silverlight WPF ResourceDictionary and that there are no XML or XAML errors.

2 - Verify that all dictionary entries are using the correct XML namespace prefix and that the matching namespace attribute ("xmlns:") is referencing the correct and fully-qualified clr-namespace, including the assembly name.

3 - Verify that the MicrosoftCommerceCatalogItemRelationshipResources.xaml file makes no reference to assemblies that are not available to the client run-time. Alternately, add the necessary Silverlight-compiled assembly to the deployment.

4 - Verify that all {StaticResource} bindings refer to keys that are present in the current file, or are defined in the executing application's resources.

There was an error communicating with the remote service. Please contact your site administrator for additional details.

This is a communication error between the application and the Commerce service.

1 - Verify that the CsManagementResources file (located in the folder where the application was downloaded) contains a CommerceServiceSettings element and that its attributes are set and valid. Verify that the EndpointAddress element points to the Commerce service proxy.

2 - Check the event log of both the machine running the proxy and the machine running the Commerce service for errors related to "CommerceManagement".

3 - Verify that the proxy is functioning properly and is accessible.

The search found {0} matches but only {1} of them are being shown. If the item you are looking for is not present, please either change your maximum # of results or try a more specific keyword.

This message is displayed when the search found more items than specified in the "Maximum # of Results" drop-down.

The user can raise the limit for the "Maximum # of Results" or try another search. The {0} and {1} are replaced at run-time by the number of total matches and the current maximum # of results, respectively.

See Also

Other Resources

Silverlight Business Administration Tools Integration