public abstract class AbstractNavigationSuggestion extends java.lang.Object implements NavigationSuggestion
This class provides helper methods for populating navigation suggestions.
This class will extend the interface 'NavigationSuggestion' and sets the name-value pairs from the search configuration and implements the method setProperties(Map properties). The method getProperties() should be called from within the handler extension class to access the set of name-value pairs.
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM Copyright notice field.
|
Constructor and Description |
---|
AbstractNavigationSuggestion() |
Modifier and Type | Method and Description |
---|---|
protected com.ibm.commerce.catalog.facade.datatypes.ShowCatalogNavigationViewDataAreaType | callGetCatalogNavigationViewService(com.ibm.commerce.catalog.facade.client.CatalogNavigationViewFacadeClient aCatNavFacadeClient, GetType aGetVerb)
This method performs a web service request: ie.
|
protected com.ibm.commerce.catalog.facade.client.CatalogNavigationViewFacadeClient | getCatalogNavigationViewFacadeClient()
This method returns a client that can be used to make a webservice request.
|
java.util.Map | getProperties()
This method returns the set of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
|
abstract void | populateSuggestion(java.lang.String profile, com.ibm.commerce.catalog.facade.datatypes.SuggestionViewType suggestionCategory)
This method populates a single navigation suggestion category for use in the storefront.
|
void | setProperties(java.util.Map properties)
This method sets the list of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
|
public static final java.lang.String COPYRIGHT
public java.util.Map getProperties()
This method returns the set of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
ie. <_config:param name="myCustomProperty" value="1000"/> The key in the properties map is 'myCustomProperty' and the value is '1000'.
public void setProperties(java.util.Map properties)
This method sets the list of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
ie. <_config:param name="myCustomProperty" value="1000"/> The key in the properties map is 'myCustomProperty' and the value is '1000'.
public abstract void populateSuggestion(java.lang.String profile, com.ibm.commerce.catalog.facade.datatypes.SuggestionViewType suggestionCategory)
This method populates a single navigation suggestion category for use in the storefront.
This method should return all possible values for this navigation suggestion category. (ie. All brands, categories, articles that will be used to aid navigation in the store)
The object suggestionCategory must be populated with your suggestion category information for your navigation suggestion to be displayed on the storefront.
In the storefront, the service is called to return all possible values for each navigation suggestion category. The storefront performs the filtering of the values as the customer types into the quick search box.
Modifications to the storefront JSPs are required. See the information center for more information describing the storefront JSPs modifications.
The JSPs requiring modification are:
This method will need to fetch all values for this NavigationSugesstion category from a data source (typically the database or the search engine) and mediate this data into the suggestionCategory (com.ibm.commerce.catalog.facade.datatypes.SuggestionViewType) and its corresponding entries, (com.ibm.commerce.catalog.facade.datatypes.SuggestionEntryViewType).
The following is a description of the SuggestionViewType and SuggestionEntryViewType objects that must be populated:
The xml data structure looks like this:
<_cat:SuggestionView> <_cat:Identifier>Brand</_cat:Identifier> <_cat:Label>Brand</_cat:Label> <_cat:Entry> <_cat:Name>MapleWear</_cat:Name> <_cat:Value>mfName_ntk_cs</_cat:Value> <_cat:Image>MapleWear</_cat:Image> <_cat:UserData> <_wcf:UserDataField name="Count">418</_wcf:UserDataField> </_cat:UserData> </_cat:Entry> <_cat:Entry> <_cat:Name>Sharpson</_cat:Name> <_cat:Value>mfName_ntk_cs</_cat:Value> <_cat:Image>Sharpson</_cat:Image> <_cat:UserData> <_wcf:UserDataField name="Count">20</_wcf:UserDataField> </_cat:UserData> </_cat:Entry> </_cat:SuggestionView>
The following is an example of how to create navigation suggestion entries (SuggestionEntryViewType) and populate them.
// Get the list of suggestion entries List suggestionEntries = suggestionCategory.getEntry(); ... // Set the label suggestionCategory.setLabel(label); ... // Create and populate the entries SuggestionEntryViewType suggestionEntry = CatalogFactory.eINSTANCE.createSuggestionEntryViewType(); com.ibm.commerce.foundation.common.datatypes.UserDataType userData = suggestionEntry.getUserData(); if(userData==null) { userData = CommerceFoundationFactory.eINSTANCE.createUserDataType(); } suggestionEntry.setUserData(userData); // Populate suggestion entry // Name suggestionEntry.setName("My suggestion name"); // Value suggestionEntry.setValue("My suggestion value to help the store developer build a URL for when a customer clicks on my suggestion"); // Image suggestionEntry.setImage("My suggestion image"); // User data Map userDataFields = userData.getUserDataField(); userDataFields.put("myCustomProperty", "myCustomValue"); // Finally, add this entry to the list of entries suggestionEntries.add(suggestionEntry);
protected com.ibm.commerce.catalog.facade.datatypes.ShowCatalogNavigationViewDataAreaType callGetCatalogNavigationViewService(com.ibm.commerce.catalog.facade.client.CatalogNavigationViewFacadeClient aCatNavFacadeClient, GetType aGetVerb)
This method performs a web service request: ie. aCatNavFacadeClient.getCatalogNavigationView(aGetVerb)
This method can be used to fetch data from the search engine for navigation suggestion population.
If an error occurs, an exception will be logged. The exception will not be thrown. A CatalogNavigationViewException exception will be captured in the log. To see the exception details, enabling the trace components for 'com.ibm.commerce.catalog.*' as well as 'com.ibm.commerce.foundation.*' will help in debugging problems fetching the data.
NULL will be returned from this method if the web service request is not successful. The extension classes that call this method should check if this method returns NULL. If this occurs, you will have an empty data set and populateSuggestion(...) will return an empty list of suggestions and will not see anything displayed for your suggestion category when entering terms into the quick search box.
protected com.ibm.commerce.catalog.facade.client.CatalogNavigationViewFacadeClient getCatalogNavigationViewFacadeClient()
This method returns a client that can be used to make a webservice request.
This method uses information from the current business context to create the client object.