Set a default layout for a page group

We can set a new default layout for pages that are managed with the Commerce Composer. When a new page is created, or when all layout assignments are removed for a page, the appropriate default layout is assigned to the page.


Before beginning

Ensure that the layout that we are setting as a default layout exists. If the layout does not exist, we must create the layout. See Creating a layout for a page.

Alternatively, we can use the Data Load utility to create a layout. For a sample that demonstrates how to create a layout, see Sample: Loading Commerce Composer layouts.


Procedure

  1. Look up the existing default layout for the page group in the WebSphere Commerce database. The layout ID for the current default layout of a page is stored in the PAGELAYOUT database table. We can look up the default layout ID in the PAGELAYOUT table. Look for the entry with the proper store ID (store_id) and page group ID (pagelayouttype_id) where the isDefault flag is set to 1. This isDefault value indicates that a layout is a default layout. For example, to find the default layout for product pages in a store with an ID of 10001, we can use the following SQL:

      select pagelayout_id from pagelayout where storeent_id=10001 and pagelayouttype_id='Product' and isdefault=1;

  2. Create a CSV file to remove the entry that sets the layout as a default layout within the PAGELAYOUT database table. Within your CSV file, set the value for the IsDefault column to be blank to remove the layout from being a default layout.

    For more information about creating this CSV file, see layout input file .

  3. Create the configuration files to run the Data Load utility to remove the existing default layout assignment. We can reuse the configuration files that you were used to create the Commerce Composer objects. If you do not have the configuration files, WebSphere Commerce provides sample files in the following directory.

    Copy, edit, and use the following sample environment and business object configuration files:

    • wc-dataload-env.xml

    • wc-loader-layout.xml

    • wc-loader-widget.xml

    • wc-loader-widgetnvp.xml

    To create the load order configuration file, copy the wc-dataload-layout.xml file from within the layout subfolder. Edit the file to remove the load items other than the layout.csv, layoutWidgetRelationship.csv, and widgetNVP load items.

  4. Run the Data Load utility.

  5. Verify the results of the data load.

  6. Edit your layout.csv, layoutWidgetRelationship.csv, and widgetNVP files to include the information to load the new default layout for the page group. Within your layout.csv file, ensure that you set the value for the PageGroup column to be the page group that is to use the default layout.For more information about the information to include within these CSV files, see

  7. Run the Data Load utility. We can reuse the configuration files that we used to remove the previous default layout for the page group.

  8. Verify the results of the data load.

  9. Open the Commerce Composer tool..

  10. Create a page that is based on the page group. Preview the page in store preview to verify that the default layout displays for the page.


Related concepts
Commerce Composer layout architecture
Layout assignments for category pages
Layout assignments for catalog entry pages
Layout assignments for search terms
Pages and page creation
Commerce Composer layout template architecture