Customize the catalog entry details page to retrieve specific merchandising associations

We can customize the catalog entry details page for a catalog entry type to use merchandising association enhancements to the productViewHandler REST service and the categoryNavigationView noun. By customizing the catalog entry details pages to use the enhanced REST service, we can define the specific merchandising association types that return for each type of catalog entry. By default all merchandising associations associated with a catalog entry are displayed when a shopper views the catalog entry details for a catalog entry.


Procedure

  1. Go to the following directory, which contains the catalog entry details JSP files for each catalog entry type.

    • workspace_dir\Stores\WebContent\store_name\ShoppingArea\CatalogSection\CatalogEntrySubsection

    Where store_name is the name of the store directory, for example, Aurora.

  2. Open the catalog entry details JSP file for editing for the catalog entry type to customize.

    • For products or SKUS, open the ProductDisplay.jsp file.

    • For bundles, open the BundleDisplay.jsp file.

    • For SKUs, open the ItemDisplay.jsp file.

    • For static kits, open the PackageDisplay.jsp file.

  3. Customize the catalog entry details JSP file to define the merchandising associations that are to return for that catalog entry type.

    1. In the JSP file, find the code that calls the default productViewHandler REST service. Search the file for the catalogNavigationView REST response. For example, in the BundleDisplay.jsp file, the following code defines the call to the REST service.

        <wcf:rest var="catalogNavigationView" url="${searchHostNamePath}${searchContextPath}/store/${WCParam.storeId}/productview/byId/${productId}" >	
        		<wcf:param name="langId" value="${langId}"/>
        		<wcf:param name="currency" value="${env_currencyCode}"/>
        		<wcf:param name="responseFormat" value="json"/>		
        		<wcf:param name="catalogId" value="${WCParam.catalogId}"/>
        	</wcf:rest>

    2. Add a parameter within the REST call definition to specify the specific merchandising association type that is to return for the catalog entry. Add the following code to include this merchandising association type parameter.

        <wcf:param name="associationType" value=""/>

    3. Specify a value for the associationType parameter. We can include a single merchandising association type or use a loop to include multiple types as the value. We can include the following values to identify a merchandising association type that is provided by default with WebSphere Commerce.

        ACCESSORY
        Indicates that accessories that complement the selected catalog entry are to return.

        UPSELL
        Indicates that an up-sell suggestion is to return to suggest a better catalog entry for the shopper to consider purchasing.

        X-SELL
        Indicates that a cross-sell suggestion is to return to suggest other catalog entries for the shopper to purchase in addition to the catalog entry that the shopper is viewing.

        REPLACEMENT
        Indicates that a replacement catalog entry is to return.

      For example, the following parameter indicates that only merchandising associations that have the type UPSELL are to return:

        <wcf:param name="associationType" value="UPSELL"/>

      To define a loop to include multiple merchandising association types, use the following format:

        <c:forEach var="maType" items=" "> 
         <wcf:param name="associationType" value="${maType}"/> 
        </c:forEach>

      Where the value for the attribute items lists the association types to return, for example:

        <c:forEach var="maType" items="UPSELL,X-SELL,ACCESSORY"> 
         <wcf:param name="associationType" value="${maType}"/> 
        </c:forEach>

    4. Save and close the file.

  4. Verify that the catalog page displays only the merchandising associations that you customized the productViewHandler REST service to return.

    1. Open the store in a web browser.

    2. Browse the store and open the catalog entry details page for a catalog entry that matches the correct catalog entry type.

    3. Verify that the only merchandising associations that display match the merchandising associations types that you customized the REST service to return.


Related concepts
Representational State Transfer (REST) services
Merchandising associations


Related tasks
Working with REST services
Manage merchandising associations


Related reference
Catalog browsing flows
Product details page
SKU details page
Bundle details page
Kit details page