Change Pages in Accelerator (Dynamic Text)
So Ben has requested that we do this in all of our new 6.0 stores, and at one time or another we’ve all seen how dynamic text has helped save us time (replacing zingers, bugs, etc) and cut down on hard-coding in our jsp files. It also helps make our sites more internationally friendly (since our international team can just grab the localized text files and edit them for what they need
). So here we go, here is how to add some dynamic text into a page that you can then edit through accelerator.
To define the new dynamic text message for the store and the Change Pages page:
- 1. Navigate to the following directory:
* WC_eardir/Stores.war/WEB-INF/classes/ConsumerDirect
* Cloudscape workspace_dir\Stores\WebContent\WEB-INF\classes\ConsumerDirect - 2. Open the storetext_dynamic_locale.properties file for editing.
- 3. Insert the following text at the end of the file:
# ShoppingArea/DiscountSection/DiscountDetailsDisplay.jsp
Discount_Disclaimer = Some restrictions may apply. Discount cannot be combined with other offers. - 4. Save and close the file.
- 5. Open the storetext_dynamic_labels_locale.properties file, located in the same directory, for editing.
- 6. Insert the following text at the end of the file:
# ShoppingArea/DiscountSection/DiscountDetailsDisplay.jsp
DiscountDisclaimer = Discount disclaimer
DiscountDisclaimer_Text = - 7. Save and close the file.
- 8. Restart your WebSphere Commerce instance to load the changed properties files.
To add the option for setting the discount disclaimer text to the Change Pages page:
- 1. Navigate to the following directory:
* WC_eardir/Stores.war/WEB-INF/xml/tools/stores/ConsumerDirect/devtools/storefront
* Cloudscape workspace_dir\Stores\Web Content\WEB-INF\xml\tools\stores\ConsumerDirect\devtools\storefront - 2. Open the StoreFront.xml file for editing.
- 3. Add the following lines to the store-front-text element:
- 4. Save and close the file.
Open your jsp file and where you want your dynamic text to appear, insert the following.
- 1. <fmt:message key=”Discount_Disclaimer” bundle=”${storeDynamicText}”/>
- 2. Save and close the file.
That should do it… please note that WordPress strips out all the formatting, so we lose all our nice tabbing, that explains why the code above looks so poor. The bulk of this post was taken directly from IBM’s tutorial website, so if you get lost, go there.