Registering a new style for the Madisons starter store
In this lesson, a new style in the style configuration file is defined and available in the WebSphere Commerce Accelerator Change Style wizard, or the Management Center Store Management tool if Feature Pack 2 is enabled. The Madisons starter store contains one style and two colors by default. In this lesson, a new color is added to the Madisons starter store and made available.
Procedure
- Update the style options for the Madisons starter store.
In the Enterprise Explorer view, navigate to the following:
File location Procedure Stores > WebContent > WEB-INF > xml > tools > stores > Madisons > devtools > flow > style - Open style.xml for editing.
- Locate the StylePanelOptions group:
<option-group id="StylePanelOptions" type="radio" panel="StylePanel">
- Add new
option
elements to the end of theoption-group
element with the existingoption
element as a template:<option id="Style.2" enables-features="Style.f.2" enables-options="Color.4 Color.5 Color.6" src="tools/stores/$storeDir$/style/styles/style2.png" />
- Locate the ColorPanelOptions group:
<option-group id="ColorPanelOptions" type="radio" panel="ColorPanel">
- Add new
option
elements to the end of theoption-group
element with the existingoption
element as a template:<option id="Color.4" enables-features="Color.f.4" src="tools/stores/$storeDir$/style/colors/color1_1.png" selected-by-default="true" /> <option id="Color.5" enables-features="Color.f.5" src="tools/stores/$storeDir$/style/colors/color1_2.png" /> <option id="Color.6" enables-features="Color.f.6" src="tools/stores/$storeDir$/style/colors/color1_3.png" />
- Save your changes and close the file.
Stores > WebContent > WEB-INF > xml > tools > stores > Madisons > devtools > flow > repository > IncludePages - Open the StyleDir.xml file for editing.
- Add the following element within the
page-components
element:<simple-implementation id="StyleDir.i1.impl2" url="include/styles/style2/" virtual-page-interface-id="StyleDir.i1" />
- Save your changes and close the file.
Stores > WebContent > WEB-INF > xml > tools > stores > Madisons > devtools > flow > repository - Open VirtualPages.xml for editing to add the CSS and image file implementations.
- Locate the virtual style sheet implementations:
<virtual-file id="vfile.stylesheet"/>
- Add the following
virtual-file-implementation
elements to the end of the section:<virtual-file-implementation virtual-file-id="vfile.stylesheet" url="css/common2_1$locale$.css" id="vfile.style4.css" locale-specific="yes" locales="iw_IL"/> <virtual-file-implementation virtual-file-id="vfile.stylesheet" url="css/common2_2$locale$.css" id="vfile.style5.css" locale-specific="yes" locales="iw_IL"/> <virtual-file-implementation virtual-file-id="vfile.stylesheet" url="css/common2_3$locale$.css" id="vfile.style6.css" locale-specific="yes" locales="iw_IL"/>
- Save your changes and close the file.
- Open the Features.xml file for editing.
- Locate the style section that begins with the following line of
code:
<!-- Features for style -->
- Add the following element to the end of the section:
<feature id="Style.f.2" enables="StyleDir.i1.impl2"/>
- Locate the color section that begins with the following:
<!-- Features for stylesheets and image directories-->
- Add the following elements to the end of the section:
<feature id="Color.f.4" enables="vfile.style4.css vfile.styleie1.css vfile.color1.dir"/> <feature id="Color.f.5" enables="vfile.style5.css vfile.styleie1.css vfile.color2.dir"/> <feature id="Color.f.6" enables="vfile.style6.css vfile.styleie1.css vfile.color3.dir"/>
Note: The elements reference existing virtual file implementations for the color image directories. - Save your changes and close the file.
LOBTools > WebContent > config > commerce > store > propertiesViews > Madisons - Open StoreFlexFlowPropertiesView.def for editing to add the new style and color options.
- Locate the
StylePanelOptions MultiValueSelector
object:<MultiValueSelector name="StylePanelOptions" promptText="${stoFlexFlow_10001.Styles.style.radio.label}" useRadioButtons="true">
- Add the new
MultiValueSelection
element to the end of theStylePanelOptions
object:<MultiValueSelection imageSrc="/lobtools/images/stores/Madisons/style/styles/style2.png"> <Xml name="values"> <url objectPath="StoreFileRef[name=StyleDir]">include/styles/style2/</url> <url significant="false" objectPath="StoreFileRef[name=vfile.color]">images/colors/color1/</url> <url significant="false" objectPath="StoreFileRef[name=vfile.stylesheet]">css/common2_1$locale$.css</url> <url significant="false" objectPath="StoreFileRef[name=vfile.stylesheetie]">css/commonie1_1$locale$.css</url> </Xml> </MultiValueSelection>
- Locate the
PropertyPane
object:<PropertyPane definitionName="stoStyles_10001" > <PropertyGroup name="group" collapsable="false">
- Add the new
MultiValueSelector
element to the end of thePropertyGroup
element:<MultiValueSelector name="ColorPanelOptions2" promptText="${stoFlexFlow_10001.Styles.color.radio.label}" useRadioButtons="true"> <EnablementCondition objectPath="StoreFileRef[name=StyleDir]" propertyName="url" enablementValue="include/styles/style2/" /> <MultiValueSelection imageSrc="/lobtools/images/stores/Madisons/style/colors/color1_1.png" name="color1"> <Xml name="values"> <url objectPath="StoreFileRef[name=vfile.color]">images/colors/color1/</url> <url objectPath="StoreFileRef[name=vfile.stylesheet]">css/common2_1$locale$.css</url> <url objectPath="StoreFileRef[name=vfile.stylesheetie]">css/commonie1_1$locale$.css</url> </Xml> </MultiValueSelection> <MultiValueSelection imageSrc="/lobtools/images/stores/Madisons/style/colors/color1_2.png" name="color2"> <Xml name="values"> <url objectPath="StoreFileRef[name=vfile.color]">images/colors/color2/</url> <url objectPath="StoreFileRef[name=vfile.stylesheet]">css/common2_2$locale$.css</url> <url objectPath="StoreFileRef[name=vfile.stylesheetie]">css/commonie1_2$locale$.css</url> </Xml> </MultiValueSelection> <MultiValueSelection imageSrc="/lobtools/images/stores/Madisons/style/colors/color1_3.png" name="color3"> <Xml name="values"> <url objectPath="StoreFileRef[name=vfile.color]">images/colors/color3/</url> <url objectPath="StoreFileRef[name=vfile.stylesheet]">css/common2_3$locale$.css</url> <url objectPath="StoreFileRef[name=vfile.stylesheetie]">css/commonie1_1$locale$.css</url> </Xml> </MultiValueSelection> </MultiValueSelector>
- Save your changes and close the file.
- In the Enterprise Explorer view,
go to the following directory:
- Stores > Web Content > tools > stores > Madisons > style > styles.
- LOBTools > WebContent > images > stores > Madisons > style > styles.
- Navigate to the temporary location where you extracted
the images.zip file and copy style\
style2.png
to the directory. - The Madisons starter store supports the style1, color1
combination by default, where the CSS file name is common1_1.css.
To support the style2, color1, style2, color2, and style2, color3
combinations, create three new CSS files called common2_1.css, common2_2.css,
and common2_3.css based on the default CSS file:
- In the Enterprise Explorer view, navigate to Stores > WebContent > Madisons > css.
- Right-click common1_1.css and click Copy.
- Right-click css and click Paste.
- Rename the copy common2_1.css.
- Right-click common1_2.css and click Copy.
- Right-click css and click Paste.
- Rename the copy common2_2.css.
- Right-click common1_3.css and click Copy.
- Right-click css and click Paste.
- Rename the copy common2_3.css.
- Copy the style1 directory to style2.
- In the Enterprise Explorer view, navigate to Stores > WebContent > Madisons > include > styles > style1.
- Right-click style1 and click Copy.
- Right-click styles and click Paste.
- Rename the copy style2.
- The style related files are located in the Stores\WebContent\Madisons\include\styles directory
by default. To support multiple styles, the CachedTopCategoriesDisplay.jsp needs to
be copied into the directory.
- In the Enterprise Explorer view, navigate to Stores > WebContent > Madisons > Snippets > Catalog > CategoryDisplay.
- Right-click CachedTopCategoriesDisplay.jsp and click Copy.
- Navigate to Stores > WebContent > Madisons > include > styles.
- Right-click style1 and click Paste.
- Right-click style2 and click Paste.
- Edit the TopCategoriesDisplay.jsp file.
- In the Enterprise Explorer view, navigate to Stores > WebContent > Madisons > ShoppingArea > CatalogSection > CategorySubsection.
- Open the TopCategoriesDisplay.jsp file in a text editor.
- Locate the following line:
<c:import url="${jspStoreDir}Snippets/Catalog/CategoryDisplay/CachedTopCategoriesDisplay.jsp">
- Replace it with the following line:
<c:import url="${jspStoreDir}${StyleDir}CachedTopCategoriesDisplay.jsp">
- Save your changes and close the file.