Essential ATG Dynamo Training - Got atg Certified Relationship Management Developer?
This is not an official ATG site: ATG, Dynamo, Scenario Server and Personalization Server are trademarks or registered trademarks of Art Technology Group
Articles Exercises Resources Links Search

CategoryPage.jhtml

The category page displays all the child categories and all the child products in this category. For each category a link to this page is created (with the itemId for the nested category), the current navCount and the push operation are supplied.

The links to the product page don't modify the category stack but simply link to the product page and pass in the itemId

<HTML> <HEAD>
<TITLE>Category Page</TITLE>
</HEAD>

<BODY>
<DROPLET bean="/atg/commerce/catalog/CategoryLookup">
  <PARAM NAME="id" VALUE="param:itemId">
  <OPARAM NAME="output">
    <H1><VALUEOF PARAM="element.itemDisplayName"></VALUEOF> Category Page</H1>
    <JAVA>
    /*
        ATTENTION: Update the NavHistoryCollector.
    */
    </JAVA>
    <droplet src="DropBreadcrumbs.jhtml">
      <param name="categoryObj" value="param:element">
    </droplet>

    <JAVA>
    /*
        ATTENTION: Use the NavHistoryCollector to display the breadcrumb trail.
    */
    </JAVA>
    <p><b>History:</b><P>
    <droplet src="ShowBreadcrumbs.jhtml">
      <param name="pageType" value="category">
    </droplet>

    <!-- Display child category links -->
    <droplet bean="/atg/dynamo/droplet/ForEach">
      <param name="array" value="param:element.childCategories">
      <oparam name="outputStart">
        <p><b>Child Categories:</b>   
        <ul>
      </oparam>
      <oparam name="output">
        <li>
          <JAVA>
          /*
              ATTENTION: Here we set up the navCount and navAction parameters
              which will indicate to the next page how it should update its
              CatalogNavHistory collector. In particular, to set the navCount,
              we query the CatalogNavHistory component, asking it for a number
              that identifies its current state. The number returned is always
              one greater than the number returned by this property the last
              time it is accessed, even after a back key has been detected.
          */
          </JAVA>
          <a href="CategoryPage.jhtml">
            <valueof param="element.displayName"></valueof>
            <param name="itemId" value="param:element.repositoryId">
            <param name="navCount" value="bean:/atg/commerce/catalog/CatalogNavHistory.navCount">
            <param name="navAction" value="push">
          </a>
        </li>
      </oparam>
      <oparam name="outputEnd">
        </ul>
      </oparam>
    </droplet>

    <droplet bean="/atg/dynamo/droplet/ForEach">
      <param name="array" value="param:element.childProducts">
      <oparam name="outputStart">
        <p><b>Child Products:</b>   
        <ul>
      </oparam>
      <oparam name="output">
        <li>
          <JAVA>
          /*
              The product page is an end node of navigation, so there is no
              need to update the CatalogNavHistory component when we view it.
          */
          </JAVA>
          <a href="ProductPage.jhtml">
            <valueof param="element.displayName"></valueof>
            <param name="itemId" value="param:element.repositoryId">
          </a>
        </li>
      </oparam>
      <oparam name="outputEnd">
        </ul>
      </oparam>
    </droplet> 
  </OPARAM>
</DROPLET>

</BODY> 
</HTML>


Technical Training Advertise your Training Programs for Free! Los Angeles Web Design Shopping Cart Software  Form a Corporation