Remove marked for delete Commerce Composer layouts

You can run the CleanPageLayoutsCmdImpl command to remove layouts from the database that business users delete. When a business user deletes a layout with the Commerce Composer tool, the layout is removed from the tool and store pages, but not from the database. The layout is only marked for delete in the database. As an administrator, run the CleanPageLayoutsCmdImpl command as a scheduled job to clean up the database by removing any layouts that are marked for delete.

When business users delete layouts in the Commerce Composer tool, the Commerce Composer framework removes the layouts from Management Center. The framework also updates the PAGELAYOUT database table to set the value of the STATE column to be 2 for the layout the business user deleted. By changing the state of the layout, the framework marks the layout for deletion when a cleanup utility or job runs. When a scheduled job that invokes the CleanPageLayoutsCmdImpl command runs, any layout with a value of 2 in the STATE column is deleted from the database. The command also invokes the delete method of the appropriate widget manager class to clean up any widget data specific for the layout. The cleanup process maintains the referential integrity of your database as the job deletes the layout and widget data.

Note: If your site uses both a staging and a production environment, run the scheduled job on the staging environment. Then, propagate the changes for your database to your production environment.

Alternatively, you can use the Data Load utility to delete layout information from the database. To delete a layout with this utility, you can use an input CSV that identifies the layout information and includes a value of 1 for the DELETE column. For more information about creating this kind of CSV file, see layout input file. To delete layouts with this method, you must identify each layout to be deleted within the CSV file. If you run a scheduled job that invokes the CleanPageLayoutsCmdImpl command, all layouts marked for delete are removed. If your database includes multiple layouts that are marked for delete, running the scheduled job can take less time.

Clean page layout scheduled job configuration

You can configure the clean page layouts scheduled job within the following file:
  • LinuxAIXworkspace_dir/WC/xml/config/com.ibm.commerce.pagelayout/wc-admin-component.xml
  • Windowsworkspace_dir\WC\xml\config\com.ibm.commerce.pagelayout\wc-admin-component.xml
The configurable properties for this job are included in the file by default. Set the value for the "cleanMarkedForDelete" configuration property to "Y" to have the job remove layouts that are marked for delete. You can also configure the job to also delete layouts that are inactive for longer that a specified number of days with the "daysExpiredToDelete configuration property. By default, the value for this property is "60" days. Your configured CleanPageLayouts job, can resemble the following code:
<_config:configgrouping name="CleanPageLayouts">
<!-- The property to configure the number of days that the page layout can be cleaned after it expired. -->

<_config:property name="daysExpiredToDelete" value="60" />

<!-- The property to configure whether to clean the page layouts that are marked for delete.
Y, clean the page layouts that are marked for delete.
N, do NOT clean the page layouts that are marked for delete.
-->

<_config:property name=cleanMarkedForDelete" value="Y"/>

</_config:configgrouping>

When this scheduled job runs, the widget data for the layout deletes first, then any layout assignment data that exists, before the job deletes the layout data. When the CleanPageLayouts process uses the WidgetManagementService.delete method to delete widget information, the method can delete the e-Marketing Spot used with the widget. If your widget includes an e-Marketing Spot, the e-Marketing Spot is deleted only if the e-Marketing Spot was created and managed with the Commerce Composer tool. To determine whether the e-Marketing Spot for a widget is created and managed with this tool, review the widget definition XML for the widget within the PROPERTIES column of the PLWIDGETNVP database table. If the widget definition XML contains the requireEMS property with a value of true, an e-Marketing Spot is created and managed with the Commerce Composer tool. If the e-Marketing Spot for the widget includes title content, this content is also deleted. e-Marketing Spots that are created and managed within the Marketing tool are not deleted.