Creating URL references

In this lesson, you add URL references to your store to create views for your new sales catalogs.

About this task

To switch between sales catalogs within the same store implementation, URL references within the store must be updated. In this lesson, you update the URL references in the CachedHeaderDisplay.jsp file to enable switching between multiple sales catalogs.

To update the CachedHeaderDisplay.jsp file, you use wcf:url reference tags. The wcf:url tag can include a number of parameters to make up a URL request that can be properly formatted to send to the WebSphere Commerce Server. The new value of the wcf:url tag is the URL command name TopCategoriesDisplay. The identifier is passed into this URL command and is the value that you specified for each sales catalog code. The following three codes specify the three catalogs you created:

  • MainSalesCatalog
  • HolidayCatalog
  • SpringFeverCatalog

Follow these steps to create URL references to the new catalog views:

Procedure

  1. Navigate to the following directory:
    • WC_eardir/Stores.war/Madisons/include/styles/style1
    • WebSphere Commerce DeveloperWCDE_installdir\workspace_dir\Stores\WebContent\Madisons\include\styles\style1
  2. Open the JSP header file that is called CachedHeaderDisplay.jsp, for editing
  3. Add the following text before the <div id="header"> tag:
    <wcf:url var="IndexSalesURL" value="TopCategoriesDisplay">
    <wcf:param name="langId" value="${langId}" />
    <wcf:param name="storeId" value="${WCParam.storeId}" />
    <wcf:param name="identifier" value="MainSalesCatalog" />
    </wcf:url>
    
    <wcf:url var="IndexHolidayURL" value="TopCategoriesDisplay">
    <wcf:param name="langId" value="${langId}" />
    <wcf:param name="storeId" value="${WCParam.storeId}" />
    <wcf:param name="identifier" value="HolidayCatalog"/>
    </wcf:url>
    
    <wcf:url var="IndexSpringFeverURL" value="TopCategoriesDisplay">
    <wcf:param name="langId" value="${langId}" />
    <wcf:param name="storeId" value="${WCParam.storeId}" />
    <wcf:param name="identifier" value="SpringFeverCatalog" />
    </wcf:url>
    
    Note: You can replace the identifier parameter with the catalogId for each sales catalog to pass the catalogId into the URL command to reference each specific catalog. To use the catalogId to pass to the URL command replace the parameter and value, where the value newSalesCatalog is the identifier code of your new sales catalog:
    <wcf:param name="identifier" value="newSalesCatalog" />
    Where the value 10001 is the catalogId of your new sales catalog:
    <wcf:param name="catalogId" value="10001" />
  4. Save and close CachedHeaderDisplay.jsp

Results

The URL references that link your new catalog views to your starter store are created. The references all point to the same view, TopCategoriesDisplay, but display a different catalog in that view. In the next lesson of the tutorial, you will create the hypertext links that display on the store header to change the catalog that a shopper views.