<%---------------------------------------------------------------------------------- NAME: nav_merch.jsp PRIMARY AUTHOR: Jack Walter CREATION DATE: 07/12/02 LAST CHANGE BY: $Author: arosen $ LAST CHANGE DATE: $Date: 2006-07-19 14:03:37 -0400 (Wed, 19 Jul 2006) $ INCLUDE DIRECTIVES: none INCLUDE ACTIONS: none DESCRIPTION: **SAMPLE** merchandizing implementation. (We can't stress "sample" enough.) This module renders supplemental object with a DGraph.SeeAlsoMerchId property in a merchandizing specific template. DATA REQUIREMENTS: Because "Merchandizing" is highly customizable, we've had to make some assumptions when rendering a reference module. The following dataspec below outlines what is required to render merchandizing as it is currently written. (Obviously, it would take very little development, yet some development nonetheless, to change or add a property name.) SUPPLEMENTAL OBJECTS: Dgraph.SeeAlsoMerchId property Zone property Style property Title property RECORD OBJECTS Name property P_PriceStr property P_Description property STYLES: Again, because "Merchandizing" is highly customizable, we simply selected three "styles" to render in this module. Obviously, the rendering of various merchandizing styles is up to the customer/developer to meet any specific requirements.. STYLE 1: Single Item --------------- | | | Sample | | Image | | | --------------- STYLE 2: Three Items --------------- --------------- --------------- | | | | | | | Sample | | Sample | | Sample | | Image | | Image | | Image | | | | | | | --------------- --------------- --------------- STYLE 3: N Items --------------- Other Featured Items... | | | Sample | | Image | | | . --------------- . . Copyright (C) 2001 by Endeca Technologies - COMPANY CONFIDENTIAL -----------------------------------------------------------------------------------%> <% // IMPORTANT: This hash defines which properties will be used // when rendering merchandizing. (See spec above.) Changing these // values will change which property keys the merchandizing rendering // looks for. Attempting to consolidate the dataspec in one location. // Obviously, this second level of indirection probably isn't needed // for a stand-alone, production application Hashtable merchProps = new Hashtable(); merchProps.put("Name", DISPLAY_KEY); merchProps.put("Description", "P_Description"); boolean hasMerch = false; // Get supplemental list SupplementList merchList = nav.getSupplements(); // Loop over supplemental objects for (int i=0; i
 nav_merch
Merchandising <% // If merch is currently being shown, render hide button if (request.getParameter("hideMerch") == null) { // Create request for hidden supplemental objects UrlGen urlg = new UrlGen(request.getQueryString(), "UTF-8"); urlg.addParam("hideMerch","1"); urlg.removeParam("sid"); urlg.removeParam("in_dym"); urlg.removeParam("in_dim_search"); urlg.addParam("sid",(String)request.getAttribute("sid")); String url = CONTROLLER+"?"+urlg; %><% } // If merch are currently being hidden, render show button else { // Create request to show supplemental objects UrlGen urlg = new UrlGen(request.getQueryString(), "UTF-8"); urlg.removeParam("hideMerch"); urlg.removeParam("sid"); urlg.removeParam("in_dym"); urlg.removeParam("in_dim_search"); urlg.addParam("sid",(String)request.getAttribute("sid")); String url = CONTROLLER+"?"+urlg; %><% } %>
<% // Loop over supplemental objects for (int i=0; i 0) { // Get first ref only DimValList ref = (DimValList)refs.get(0); String ids = ""; // Loop over dimension vals for each nav reference for (int k=0; k
<% // Set up merchandizing header %> <% // Get record list ERecList supRecs = sup.getERecs(); // Get first record ERec rec = (ERec)supRecs.get(0); // Get property map for record PropertyMap propsMap = rec.getProperties(); // Create record request UrlGen urlg = new UrlGen("", "UTF-8"); urlg.addParam("R",rec.getSpec()); urlg.addParam("eneHost",(String)request.getAttribute("eneHost")); urlg.addParam("enePort",(String)request.getAttribute("enePort")); urlg.addParam("displayKey",(String)request.getParameter("displayKey")); urlg.addParam("sid",(String)request.getAttribute("sid")); urlg.addParam("in_merch",(String)merchPropsMap.get("Title")); url = CONTROLLER+"?"+urlg; DecimalFormat dm = new DecimalFormat("$#0.00"); // Display single record %>
Zone: <%= merchPropsMap.get("Zone") %> / Merch Id: <%= merchPropsMap.get("DGraph.SeeAlsoMerchId") %> / Sample Style 1
<%= merchPropsMap.get("Title") %>
<%= propsMap.get(merchProps.get("Name")) %>
<%= propsMap.get(merchProps.get("Description")) %>
<% } //--------------------------------------------------------------- // MERCHANDIZING RECORDS (STYLE 2) ------------------------------ else if (((String)merchPropsMap.get("Style")).equals("Style 2")) { %>
<% // Set up merchandizing header %>
Zone: <%= merchPropsMap.get("Zone") %> / Merch Id: <%= merchPropsMap.get("DGraph.SeeAlsoMerchId") %> / Sample Style 2
<%= merchPropsMap.get("Title") %>
<% // Get record list ERecList supRecs = sup.getERecs(); // Cut off display at 3 records int count = supRecs.size(); if (count > 3) { count = 3; } // Loop over records for (int j=0; j <% } %>

<%= propsMap.get(merchProps.get("Name")) %>
<% } //-------------------------------------------------------------- // MERCHANDIZING RECORDS (STYLE 3) ----------------------------- else if (((String)merchPropsMap.get("Style")).equals("Style 3")) { %>
<% // Set up merchandizing header %>
Zone: <%= merchPropsMap.get("Zone") %> / Merch Id: <%= merchPropsMap.get("DGraph.SeeAlsoMerchId") %> / Sample Style 3
<%= merchPropsMap.get("Title") %>
<% // Get record list ERecList supRecs = sup.getERecs(); // Get first record ERec rec = (ERec)supRecs.get(0); // Get property map for record PropertyMap propsMap = rec.getProperties(); // Create record request UrlGen urlg = new UrlGen("", "UTF-8"); urlg.addParam("R",rec.getSpec()); urlg.addParam("eneHost",(String)request.getAttribute("eneHost")); urlg.addParam("enePort",(String)request.getAttribute("enePort")); urlg.addParam("displayKey",(String)request.getParameter("displayKey")); urlg.addParam("sid",(String)request.getAttribute("sid")); urlg.addParam("in_merch",(String)merchPropsMap.get("Title")); url = CONTROLLER+"?"+urlg; // Display 1st record %>

<%= propsMap.get(merchProps.get("Name")) %>
Other Featured Items...
<% // Loop over remaining records for (int j=1; j <%= propsMap.get(merchProps.get("Name")) %>
<% } %>
<% } //-------------------------------------------------------------- // MERCHANDIZING RECORDS (STYLE of empty string and URL prop = Keyword Redirects) ----------------------------- else if (((merchPropsMap.get("DGraph.KeywordRedirectUrl")) != null) && (((String)merchPropsMap.get("Style")).equals(""))) { %>
<% // Set up merchandizing header %>
Merch Id: <%= merchPropsMap.get("DGraph.SeeAlsoMerchId") %>
Keyword Redirect
<% // Get redirectURL String redirectURL = (String)merchPropsMap.get("DGraph.KeywordRedirectUrl"); if (! ((redirectURL.startsWith("http://")) || redirectURL.startsWith("https://")) ) { redirectURL = "http://" + redirectURL; } // Display redirectURL %>
<%= redirectURL %>
<% } // TC - SHOW RULE NAME AND LINKS TO RECORDS RETURNED else { %>
<% // Set up merchandizing header %>
Zone: <%= merchPropsMap.get("Zone") %> / Merch Id: <%= merchPropsMap.get("DGraph.SeeAlsoMerchId") %> / Style: <%= merchPropsMap.get("Style") %>
<%= merchPropsMap.get("Title") %>
<% // Get record list ERecList supRecs = sup.getERecs(); %> <% // Loop over records for (int j=0; j <%= recordName %>
<% } %>
<% } //-------------------------------------------------------------- // ERROR: UNKNOWN MERCHANDIZING STYLE ----------------------------- /* else { %>
Unknown Merch Style
<% } */ //-------------------------------------------------------------- } } %>
<% } %>