Adding the profile field content to the Madisons starter store

In this lesson, you will add the content to display for the new storeManager field in the Madisons starter store.

About this task

Using the new profile field defined in the Management Center, you can display further contact information in the Madisons starter store. The custom field contains the new contact information is retrieved during a getData service request for data of type OnlineStoreType. An example of this request is shown in the following code snippet:
<wcf:getData type="com.ibm.commerce.infrastructure.facade.datatypes.OnlineStoreType" var="onlineStore" expressionBuilder="findByUniqueID">

Procedure

  1. In the Enterprise Explorer view, navigate to Stores > WebContent > Madisons > StoreInfoArea.
  2. Open HelpContactUsDisplay.jsp for editing.
  3. Update the code for each userDataField element that returns from service requests. The code indicates to print out the content of the field if the userDataField is associated with field1 in the database.
    1. Locate the following code snippet:
      <div class="content" id="WC_HelpContactUsDisplay_div_18">
        <div class="static_pages_line" id="WC_HelpContactUsDisplay_div_19"></div>
         <div class="info" id="WC_HelpContactUsDisplay_div_20">
           <span  class="contact_img"><c:out value=>"/></span>
           <p><fmt:message key="CONTACT_MSG1" bundle="${storeText}" /></p>
           <br />
           <p><fmt:message key="CONTACT_MSG2" bundle="${storeText}" /></p>
           <br />
           <div class="address" id="WC_HelpContactUsDisplay_div_21">
             <wcf:getData type="com.ibm.commerce.infrastructure.facade.datatypes.OnlineStoreType" var="onlineStore" expressionBuilder="findByUniqueID">
             <wcf:param name="storeId" value="${param.storeId}" />
             </wcf:getData>
             <c:set var="contact" value="${onlineStore.onlineStoreContactInfo[0]}" />
             <%@ include file="../Snippets/ReusableObjects/AddressDisplay.jspf"%>
           </div>
           <br /><br />
         </div>
      </div>
    2. Replace the code with the following code snippet:
      <div class="content" id="WC_HelpContactUsDisplay_div_18">
       <div class="static_pages_line" id="WC_HelpContactUsDisplay_div_19"></div>
       <div class="info" id="WC_HelpContactUsDisplay_div_20">
        <span  class="contact_img"><img src="<c:out value="${jspStoreImgDir}/images/advertisements/${locale}/img_help_contact_us.png"/>" alt="CONTACT_US3 bundle="${storeText}" />"/></span>
        <p><fmt:message key="CONTACT_MSG1" bundle="${storeText}" /></p>
        <br />
        <p><fmt:message key="CONTACT_MSG2" bundle="${storeText}" /></p>
        <br />
        <div class="address" id="WC_HelpContactUsDisplay_div_21">
         <wcf:getData type="com.ibm.commerce.infrastructure.facade.datatypes.OnlineStoreType" var="onlineStore" expressionBuilder="findByUniqueID">
          <wcf:param name="storeId" value="${param.storeId}" />
         </wcf:getData>
         <c:set var="contact" value="${onlineStore.onlineStoreContactInfo[0]}" />
         <c:forEach var="userDataField" items="${onlineStore.userData.userDataField}">
          <c:if test="${userDataField.typedKey == 'customField1'}">
          ${userDataField.typedValue}
          </c:if>
         </c:forEach>
         <br />
      
         <%@ include file="../Snippets/ReusableObjects/AddressDisplay.jspf"%>
        </div>
        <br /><br />
       </div>
      </div>
  4. Save your changes and close the file.

Results