Registering a Commerce Composer layout template
Use the Data Load utility to register your custom layout template within the Commerce
Composer framework and have your store subscribe to the layout template. A store must subscribe to
the template before users can select the template to begin composing a page layout for that
store.
About this task
- Since the container for a layout template is an empty widget, the Data Load utility loads the information to register your template into the PLWIDGETDEF and PLWIDGETDEFDESC database tables.
- Information to subscribe a store to the template into the PLSTOREWIDGET database table.
- Information to define the wireframe that displays in the Commerce Composer tool for the template
and any slot restrictions into the PLWIDGETSLOT database
table.Note: The wireframe displays only within the Commerce Composer tool as a visual representation of how a layout template displays when all of template slots are populated. This wireframe is not connected to the actual arrangement of the widgets on a store page. Depending on how a business user constructs a layout, the actual display of the layout can differ significantly from the visual representation of the template that a wireframe provides. The wireframe is used only within the Commerce Composer tool to help business users select the appropriate template to construct a layout and to select slots for including widgets within a layout.
- Information to define the template into the PAGELAYOUT database table.
Procedure
-
Create the CSV files and Data Load utility configuration files for loading your layout template
information. To help you create these files, HCL Commerce provides sample files for
loading layout template information. Use these sample files to model your CSV and configuration
files.
- Create a directory to include the CSV files and Data Load utility configuration files for loading layout template information. You can create this directory anywhere within your file system, however for the following steps a template-MyCompany directory is created within the WCDE_installdir\samples\DataLoad\CommerceComposer directory.
- Go to the WCDE_installdir\samples\DataLoad\CommerceComposer\template directory. This directory includes the sample CSV files and load order configuration file for loading template information.
-
Copy the following files:
- registerWidgetdef.csv
- slotDefinition.csv
- subscribeWidgetdef.csv
- template.csv
- wc-dataload-template.xml
- Add the copied files into your directory for layout template Data Load utility files.
- Optional:
Copy the business object configuration files for loading layout template information from the
WCDE_installdir\samples\DataLoad\CommerceComposer
directory.
This directory includes the remaining sample configuration files for loading template information. If you are not customizing these files, you can use the files in the CommerceComposer directory and do not need to copy the files. If you do want to update these files, copy the following files into your new directory.
- wc-dataload-env.xml
- wc-loader-registerWidgetdef.xml
- wc-loader-subscribeWidgetdef.xml
- wc-loader-template.xml
- wc-loader-widgetslot.xml
Update the CSV input files to include your layout template information
-
Prepare the data load input file that contains the identifier, descriptive, and definition
information for registering your layout template container.
- Open the registerWidgetDef.csv file for editing. By default, this file includes the required columns for registering a template and data for loading sample template containers.
-
Delete the sample data within this file. Do not remove any of the columns. Add the data for
your custom layout template container into the file.
Within your CSV file, you must set the following column values
- Set a value that for the
WidgetDefIdentifier
that is unique within the list of all layout template containers and Commerce Composer widgets. - Set the value of the
WidgetVendor
column to be your company name. - Set the
WidgetType
value to be2
. This column identifies the type of widget that you are registering. A widget can be either a Commerce Composer widget (value of1)
, or a layout template container (value of2
). - Set the value for the
WidgetPath
to be the relative path to the container JSP file for your layout template. This path is relative from the workspace_dir\Stores\WebContent directory. Use forward slashes in the file path. - Set the value for the
WidgetDefinitionxml
to be an empty element. - Set the value for the
WidgetState
column to1
to indicate that the container registration is active.
For example, your complete registerWidgetDef.csv CSV can resemble the following code:
For more information about the information to include within this file, see registerWidgetdef input file.WidgetDefIdentifier,WidgetVendor,WidgetType,WidgetPath,WidgetDefinitionxml,WidgetState,Delete MyCustomLayoutTemplateContainer,MyCompany,2,Container-vendor/MyCustomLayoutTemplate.jsp,<Definition></Definition>,1,
- Set a value that for the
- Save and close the file.
-
Prepare the data load input file for subscribing a store to your layout template
container.
- Open the subscribeWidgetdef.csv file for editing. By default, this file includes the required columns for subscribing a store to a template and includes sample data.
-
Delete the sample data within this file. Do not remove any of the columns. Add the data for
your custom layout template container into the file.
Within your CSV file, you must set the following column values
- Set the value for the
WidgetDefIdentifier
to be the same value that you set within the registerWidgetDef.csv file. - Do not set a value for the
WidgetDefinitionxml
column. - Set the value for the
WidgetState
column to1
to indicate that the store subscription is active. - You do not need to set the ID value for your store within this file. By default, the Data Load utility subscribes the store that is configured within the Data Load utility environment configuration file to the layout template. You can set a different store to subscribe to the template by updating the environment configuration file.
For example, your complete subscribeWidgetdef.csv CSV can resemble the following code:
For more information about the information to include within this file, see subscribeWidgetdef input file.WidgetDefIdentifier,WidgetDefinitionxml,WidgetState,Delete MyCustomLayoutTemplateContainer,,1
- Set the value for the
- Save and close the file.
-
Prepare the data load input file that defines the template information. This information
includes the layout template name and description, both of which displays for the template in the
Commerce Composer tool.
- Open the template.csv file for editing. By default, this file includes the required columns for defining the template and includes sample data.
-
Delete the sample data within this file. Do not remove any of the columns. Add the data for
your custom layout template into the file.
Within your CSV file, you must set the following column values
- Set the value of the
LayoutName
column to be the reference name for the template that you are defining the wireframe for. This value displays in Management Center to identify the template. The value for this column must match the value that you set within the slotDefinition.csv file. - Set the value for the
Description
column to be the string of text that you want to display for the layout template within the Commerce Composer tool. This description displays within the New Layout Template Selection window for your custom layout template. - Set the value for the
DeviceClass
column to identify the type or types of device classes that users can design a page layout for when they use your custom layout template. You can define a layout template to be used for creating layouts forWeb
,Mobile
, orAny
devices. - Set the value of the
State
column to be1
to activate your layout template for use in composing a page layout. - Set the
IsTemplate
value to beTRUE
. This value indicates that your are loading a layout template. - Set the
IsDefault
value to beFALSE
. This column value indicates whether you are loading a default layout. - Set the value of the
ParentWidgetDefIdentifier
andAdminName
columns to be the administrative name for the container in this template. Set this name to be the same as theWidgetDefIdentifier
that you set in the registerWidgetDef.csv file.
For example, your complete template.csv CSV can resemble the following code:
For more information about the information to include within this file, see template input file.LayoutName,Description,DeviceClass,State,IsTemplate,IsDefault,ParentWidgetDefIdentifier,AdminName,Delete "Any page, seven slots, tabs","Seven-slot template with a row of four tabs. Can be used for any page.",Any,1,TRUE,FALSE,MyCustomLayoutTemplateContainer,MyCustomLayoutTemplateContainer,
- Set the value of the
- Save and close the file.
-
Prepare the data load input file for loading the slot definition information
- Open the slotDefinition.csv file for editing. By default, this file includes the required columns for defining the overall template wireframe that displays for the template within the Commerce Composer tool. This file also loads any slot restrictions for the template. The sample CSV file also includes data for defining the slots for a sample template.
-
Delete the sample data within this file. Do not remove any of the columns. Add the data for
your custom layout template container into the file.
Within your CSV file, you must set the following column values
- Set the value of the
LayoutName
column to be the reference name for the template that you are defining the wireframe for. This value displays in Management Center to identify the template. The value for this column must match the value that you set within the template.csv file. - Set the value of the
AdminName
column to be the administrative name for the container in this template. Set this name to be the same as theWidgetDefIdentifier
that you set in the registerWidgetDef.csv file. - Set the value of the
SlotAdminName
to be the display name for the slot. The value for this column displays in the Commerce Composer tool within the wireframe to identify the slot. - Set the value of the
SlotID
column to be the value of the internal slot name. - Set the
SlotType
column to be1
. This column is reserved for IBM internal use. The value must be set to1
- Within the value for the
SlotProperty
column, define the coordinates for the layout template wireframe and identify and restriction groups for the template. Use the following format:
For instance to include a restriction group to restrict a slot to use only the widgets that are intended for use as a tabbed slot title, use"xLocation:00;yLocation:00;width:00;height:00,allowedWidgetGroups:WidgetGroupIdentifier"
allowedWidgetGroups:WidgetForTabTitle
. For more information about widget restriction groups, see Creating Commerce Composer widget restriction groups.To define your wireframe, the maximum width is 166 and the maximum height is 218. Divide your wireframe to include the layout template slots. For tabbed slots appenddottedRightBorder:true
to the coordinates system to add a dotted line to the column. This dotted line identifies the column as a tabbed slot.Tip: Consider using an image editor that displays coordinates to help you set the coordinates for your template wireframe. In the image editor, draw your as you want it to display in the Commerce Composer tool. Use the coordinates for this image as the coordinates of the wireframe in your CSV input file.
The following code defines the slotDefinition.csv CSV file for loading the Any page, seven slots, tabs layout template:
For more information about the information to include within this file, see slotDefinition input file.LayoutName,AdminName,SlotAdminName,SlotID,SlotType,SlotProperty "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,1,1,1,xLocation:0;yLocation:0;width:83;height:20 "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,2,2,1,xLocation:83;yLocation:0;width:83;height:20 "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Title 3",Title3,1,xLocation:0;yLocation:20;width:40;height:20;allowedWidgetGroups:WidgetForTabTitle "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Title 4",Title4,1,xLocation:40;yLocation:20;width:43;height:20;allowedWidgetGroups:WidgetForTabTitle "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Title 5",Title5,1,xLocation:83;yLocation:20;width:43;height:20;allowedWidgetGroups:WidgetForTabTitle "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Title 6",Title6,1,xLocation:126;yLocation:20;width:40;height:20;allowedWidgetGroups:WidgetForTabTitle "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Tab 3",3,1,xLocation:0;yLocation:40;width:40;height:50;dottedRightBorder:true "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Tab 4",4,1,xLocation:40;yLocation:40;width:43;height:50;dottedRightBorder:true "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Tab 5",5,1,xLocation:83;yLocation:40;width:43;height:50;dottedRightBorder:true "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,"Tab 6",6,1,xLocation:126;yLocation:40;width:40;height:50 "Any page, seven slots, tabs",MyCustomLayoutTemplateContainer,7,7,1,xLocation:0;yLocation:90;width:166;height:128
- Set the value of the
- Save and close the file.
Configure and run the Data Load utility
-
Configure the environment settings for running the Data Load utility.
-
Open the wc-dataload-env.xml data load environment configuration file for
editing.
This file configures the Data Load utility environment variables, such as the database settings, ID resolver, and data writer.
-
Update the file to match your database and environment settings.
For more information, see Configuring the data load environment settings. You can enter a value for your store identifier in this file or enter the store identifier when you run the Data Load utility to load the CSV files. The store identifier is used to identify the store that subscribes to your layout template. The store identifier is case-sensitive. You can find the value for your store identifier within the IDENTIFIER column of the STOREENT database table.Note: If you are using the extended sites business model and want this layout template to be available to all of your extended sites, use the store identifier for your storefront asset store. Alternatively, you can use a store identifier of a specific extended site if you want the layout template to be available only to that extended site.
- Save your file.
-
Open the wc-dataload-env.xml data load environment configuration file for
editing.
- Optional:
Configure the load order for when you run the Data Load utility. This configuration identifies
the sequence that the Data Load utility loads your CSV input files. If you included your new
directory for layout template information within the
WCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer
directory, and did not move the business object configuration files, or rename the CSV input files,
you do not need to update this file.
- Open the wc-dataload-template.xml file for editing.
-
Update the values for each
businessObjectConfigFile
andlocation
attribute to reference the correct location and names for your files. - Save and close the file.
For more information about working with this file, see Configuring the data load order. - Optional:
Configure the business object configuration files for loading your layout template
information.
By default, you do not need to update these files to load your layout template information. For more information if you do want to update these files, see Configuring the business object configuration file. The following files are the business object configuration files that are used to load layout template information:
- wc-loader-registerWidgetdef.xml
- wc-loader-subscribeWidgetdef.xml
- wc-loader-template.xml
- wc-loader-widgetslot.xml
-
Run the Data Load
utility.
- In a command-line utility, go to the WCDE_installdir\bin directory.
-
Run the following command to load the input files to register and define your layout template,
and have your store subscribe to the template.
dataload.bat ..\samples\DataLoad\CommerceComposer\template-MyCompany\wc-dataload-template.xml
Where- template-MyCompany
- The folder that you created to include your layout template CSV files.
- Verify the results of the data load.
For more information about using Data Load utility to load layout template information, see Sample: Loading Commerce Composer layout templates.