Product details sample code for supporting getpageDesign service

You can use the following sample code to help model your code for your the starter store Product Details page. The following code calls the Commerce Composer framework to retrieve product details and widget data. You can add the code before the HTML section of code in the ProductDisplay.jsp JSP file for the Product Details page.This code is used as part of enabling a starter store to use the Commerce Composer framework for designing and managing store page layouts. By default, the Product Details page for the Aurora starter store uses the getPageDesign service.
<%@include file="../../../Common/EnvironmentSetup.jspf" %>
<c:if test="${!empty productId}">
  <%-- Since this is a product page, get all the details about this product and save it in internal cache, so that other components can use it... --%>
  
  <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>
	  <wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="catalogNavigationViewBOD"
expressionBuilder="getCatalogEntryViewSummaryByID" varShowVerb="showCatalogNavigationView" maxItems="1" recordSetStartNumber="0">
	    <wcf:param name="accessProfile" value="IBM_Store_Summary_SEO"/>
    <wcf:param name="searchProfile" value=""/>
    <wcf:param name="UniqueID" value="${productId}"/>
    <wcf:contextData name="storeId" data="${storeId}" />
    <wcf:contextData name="catalogId" data="${catalogId}" />
  </wcf:getData>
  <%-- Cache it in our internal hash map --%>
  <c:set var="key1" value="${productId}+getCatalogEntryViewAllByID"/>
  <wcf:set target = "${cachedCatalogEntryDetailsMap}" key="${key1}" value="${catalogNavigationView.catalogEntryView[0]}"/>
  
  <c:if test="${!empty catalogNavigationView && !empty catalogNavigationView.catalogEntryView[0]}">
    <c:set var="catalogEntryDetails" value="${catalogNavigationView.catalogEntryView[0]}"/>
  </c:if>
  	
  <c:set var="parentCatEntryId" value="${catalogNavigationView.catalogEntryView[0].parentCatalogEntryID}" scope="request"/>
  <%-- If parentCateEntryId is not empty, then this is an item and not a product --%>
  <c:if test="${not empty parentCatEntryId}">
    <%-- Since this is an item, get all the details about the parent product and save it in internal cache, so that other components can use it... --%>
    <wcf:rest var="parentCatalogNavigationView" url="${searchHostNamePath}${searchContextPath}/store/${WCParam.storeId}/productview/byId/${parentCatEntryId}" >
      <wcf:param name="langId" value="${WCParam.langId}"/>
      <wcf:param name="currency" value="${env_currencyCode}"/>
      <wcf:param name="responseFormat" value="json"/>
      <wcf:param name="catalogId" value="${WCParam.catalogId}"/>
    </wcf:rest>
    
    <%-- Check if the parent is a product and not package or bundle --%>
    <c:if test="${parentCatalogNavigationView.catalogEntryView[0].catalogEntryTypeCode eq 'ProductBean'}">
      <%-- Keep all the defining attributes and its value in WCParam so that it will be selected by default --%>
      <c:forEach var="attribute" items="${catalogNavigationView.catalogEntryView[0].attributes}">
        <c:if test="${attribute.usage eq 'Defining'}">
          <c:set target="${WCParam}" property="${attribute.name}" value="${attribute.values[0].value}"/>
        </c:if>
      </c:forEach>
      
      <%-- So that the parent page can be displayed instead of item page and pre select the values correspoding to the item --%>
      <c:set var="catalogNavigationView" value="${parentCatalogNavigationView}" />
      <c:set var="productId" value="${parentCatEntryId}" scope="request"/>
      <c:set var="catalogEntryDetails" value="${catalogNavigationView.catalogEntryView[0]}"/>
      
      <%-- Cache parent catalog entry in our internal hash map --%>
      <c:set var="key1" value="${productId}+getCatalogEntryViewAllByID"/>
      <wcf:set target = "${cachedCatalogEntryDetailsMap}" key="${key1}" value="${catalogNavigationView.catalogEntryView[0]}"/>
    </c:if>
  </c:if>
</c:if>

<c:set var="type" value="${fn:toLowerCase(catalogEntryDetails.catalogEntryTypeCode)}" />
<c:set var="type" value="${fn:replace(type,'bean','')}" />
<c:choose>
  <c:when test="${type == 'item'}">
    <c:set var="pageGroup" value="Item" scope="request"/>
  </c:when>
  	<c:otherwise>
    <c:set var="pageGroup" value="Product" scope="request"/>
  </c:otherwise>
</c:choose>
<wcf:getData type="com.ibm.commerce.pagelayout.facade.datatypes.PageDesignType" var="pageDesign" scope="request" expressionBuilder="getPageDesign">
  <wcf:contextData name="storeId" data="${storeId}" />
  <wcf:contextData name="catalogId" data="${catalogId}" />
  <wcf:param name="deviceClass" value="Web"/>
  <wcf:param name="pageGroup" value="${pageGroup}"/>
  <wcf:param name="ObjectIdentifier" value="${productId}"/>
  <%--
  <c:forEach var="aParam" items="${WCParamValues}">
    <c:forEach var="aValue" items="${aParam.value}">
      <wcf:param name="${aParam.key}" value="${aValue}"/>
    </c:forEach>
  </c:forEach>
  --%>
</wcf:getData>
<c:set var="PAGE_DESIGN_DETAILS_VAR" value="pageDesign" scope="request"/>