WebSphere Commerce v7.0 Feature Pack 2 introduced a new way to handle change flows, now referred to as store functions. For those not familiar with store functions, a store function is basically a way to handle and control pieces of your pages and/or logic from display or execution based upon the availability of the feature within your store.
Store functions are managed through the marketing database, specifically the EMSPOT and DMEMSPOTDEF tables.
Per the IBM Info Center, on the specific reason why these changes were made with regards to the management of store functions within the marketing database: “In WebSphere Commerce Accelerator, change flow data is saved in configuration files within the Stores.war file. Since store function and store style data in Management Center is saved in the Marketing database, you no longer need to update your EAR file or the style.xml and VirtualPages.xml files when you change selected store functions or store style.”
You can load and modify new or existing store functions using the WC massload and the XML show below. The following elements will need to be replaced within the XML elements to load correctly, and to meet your specific needs. As a note the feature will be set to a status of enabled by using the XML show below, but can be loaded disabled by flipping the content value to false instead of true.
- {STOREFUNCTION_NAME}: The name of the store function to be created or updated.
- {STOREFUNCTION_DESCRIPTION}: A description of the store function to be created or updated.
- {@EMSPOT_ID_RESOLUTION_ID}: This is your massload XML resolution identifier for the EMSPOT.EMSPOT_ID value.
- {@STOREENT_ID_RESOLUTION_ID}: This is your massload XML resolution identifier for the STOREENT.STOREENT_ID value.
- {@DMEMSPOTDEF_ID_RESOLUTION_ID}: This is your massload XML resolution identifier for the DMEMSPOTDEF.DMEMSPOTDEF_ID value.
<emspot
emspot_id="{@EMSPOT_ID_RESOLUTION_ID}"
storeent_id="{@STOREENT_ID_RESOLUTION_ID}"
name="{STOREFUNCTION_NAME}"
description="{STOREFUNCTION_DESCRIPTION}"
usagetype="STOREFEATURE"
/>
<dmemspotdef
dmemspotdef_id="{@DMEMSPOTDEF_ID_RESOLUTION_ID}"
emspot_id="{@EMSPOT_ID_RESOLUTION_ID}"
storeent_id="{@STOREENT_ID_RESOLUTION_ID}"
contenttype="FeatureEnabled"
content="true"
/>
Now that your store function has been loaded, you can start leveraging their functionality to enable and disable components within your JSP pages. To check and work with store functions within your JSP pages, you will leverage the flow JSTL tag library. The following code can be added to applicable JSP pages as shown below.
<%@ taglib uri="flow.tld" prefix="flow" %>
<flow:ifEnabled feature="{STORE_FUNCTION_NAME}">
<!– Logic to be included here if the store function is enabled. –>
</flow:ifEnabled>
<flow:ifEnabled feature="{STORE_FUNCTION_NAME}">
<!– Logic to be included here if the store function is disabled. –>
</flow:ifEnabled>
If you would like to check the enabled or disabled status of store functions within your Java classes and code, I have written another post that includes the necessary logic that can be used. Please refer to the post WebSphere Commerce Store Functions Java Methods.
*Note: If working with WebSphere Commerce v7.0 Feature Pack 2 or later, any previously change flows created and managed through the flex flow XML files, will need to be migrated to be handled through the store functions logic.