To add a custom property to the site configuration you must:
Add the property to the
siteConfiguration
item type in an/atg/multisite/siteRepository.xml
definition file stored in<ATG10dir>/home/localconfig
. You can add the property to an existing table or create a new table to store the property.When you create the new property, you have the option of assigning it to a property grouping. If you choose not to assign the property to a grouping, the property will appear on the Site tab (assuming it is not marked as hidden). If you assign the property to a grouping that does not exist, it will also appear on the Site tab.
If your property values need to be translated, you should create an entry for the property in an existing resource bundle file, such as
/atg/projects/store/multisite/StoreSiteRepositoryTemplateResources.properties
, and put it in<ATG10dir>/home/locallib
. Alternatively, create a new resource bundle, if necessary, for the property, making sure it resides in yourCLASSPATH
. If your property does not require translating, you can enter literal strings in the repository definition.Update the database to reflect the new property.
Rebuild the ATG
EAR
files for your application and restart the ATG servers.
When you update the database to reflect the new property, you must take the following into account:
Because all multisite environments use ATG Content Administration, you must update both the publishing and production schemas. If you are using staging or preview servers, you must update their schemas as well.
If you are using a switch deployment, you must update both the
switchingA
andswitchingB
schemas (theswitchingCore
schema doesn’t store site configuration data). See the ATG Content Administration Programming Guide for more information on switch deployments.If you are adding a new table to store the property, the table must have an ID column in all schemas and this column must be populated with valid site IDs. In other words, this is an auxiliary table that is linked to the
site_configuration
table through site IDs. In the publishing schema, the table must also have any required Content Administration columns. See the ATG Content Administration Programming Guide for more details.If you are adding a property to an existing table, you only need to add a column for that property to the existing table in the database, keeping in mind that the table may appear in multiple locations, depending on your environment, as described above.
If your new property’s value is a reference to a new item type, you will have to define a primary table for the new item type in all the relevant schemas. In the publishing schema, this table must include the full complement of ATG Content Administration versioning columns described in Create and Install the Versioned Schema in the ATG Content Administration Programming Guide.
The following excerpts from the configuration files for Commerce Reference Store show how to add a table, crs_site_attribute
, with a number of new site configuration properties. This example assumes an environment that includes ATG Content Administration and has a switching database, so this table must be added to the publishing
, switchingA
, and switchingB
schemas.
Excerpt from /atg/multisite/siteRepository.xml from Commerce Reference Store
This excerpt defines the crs_site_attribute
table with Commerce Reference Store-specific site configuration properties. You can view the source for this table definition in the /atg/multisite/siteRepository.xml
file in <ATG10dir>/CommerceReferenceStore/Store/EStore/config/config.jar
. Note that all the Commerce Reference Store site configuration properties are assigned to property groupings, using the category-resource
attribute.
Note: Commerce Reference Store creates additional internationalization-related properties in the /atg/multisite/siteRepository.xml
file located in <ATG10dir>/CommerceReferenceStore/Store/EStore/International/config/config.jar
.
<table name="crs_site_attribute" type="auxiliary" id-column-name="id"> <property name="resourceBundle" data-type="string" column-name="resource_bundle" display-name-resource="resourceBundle" category-resource="categoryPresentation"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="20"/> </property> <property name="newProductThresholdDays" data-type="int" column-name="prod_threshold" display-name-resource="newProductThreshold" category-resource="categoryCommerce"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="160"/> </property> <property name="defaultPageSize" data-type="int" column-name="page_size" display-name-resource="defaultPageSize" category-resource="categoryPresentation"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="40"/> </property> <property name="cssFile" data-type="string" column-name="css_file" display-name-resource="cssFile" category-resource="categoryAppearance"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="20"/> </property> <property name="largeSiteIcon" data-type="string" column-name="large_site_icon" display-name-resource="largeSiteIcon" category-resource="categoryAppearance"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="40"/> </property> <property name="defaultCountry" data-type="string" column-name="default_country_code" display-name-resource="defaultCountry" category-resource="categoryLocalization"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="20"/> </property> <property name="emailAFriendEnabled" data-type="boolean" column-name="emailafriend" display-name-resource="emailAFriendEnabled" category-resource="categoryEmail"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="20"/> </property> <property name="backInStockFromAddress" data-type="string" column-name="backinstock_addr" display-name-resource="backInStockFromAddress" category-resource="categoryEmail"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="40"/> </property> <property name="newPasswordFromAddress" data-type="string" column-name="newpass_addr" display-name-resource="newPasswordFromAddress" category-resource="categoryEmail"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="60"/> </property> <property name="changePasswordFromAddress" data-type="string" column-name="changepass_addr" display-name-resource="changePasswordFromAddress" category-resource="categoryEmail"> <attribute name="resourceBundle" value="atg.projects.store.multisite.StoreSiteRepositoryTemplateResources"/> <attribute name="propertySortPriority" value="80"/> </property> <-- Additional email-related properties comprise the remainder of the CRS siteRepository.xml file. --> </table>
/atg/projects/store/multisite/StoreSiteRepositoryTemplateResources.properties
This code excerpt shows the resource bundle that properties in the crs_site_attribute
table rely on. You can find the source for this resource bundle in the /atg/projects/store/multisite/StoreSiteRepositoryTemplateResources.properties
file located in <ATG10dir>/CommerceReferenceStore/Store/EStore/lib/classes.jar
,
# Resource strings for SiteRepository # atg_flags=i18n,l10n categoryCommerce=Commerce categoryBasics=Basics categoryPresentation=Presentation categoryAppearance=Appearance categoryEmail=Email categoryLocalization=Localization catalogId=Catalog Id listPricelistId=List price list Id salePricelistId=Sale price list Id resourceBundle=Resource Bundle newProductThreshold=New Product Threshold Days defaultPageSize=Default Page Size cssFile=Path to CSS File largeSiteIcon=Large Site Icon defaultCountry=Default Country emailAFriendEnabled=Email a Friend Enabled backInStockFromAddress=Back in Stock From Address newPasswordFromAddress=New Password From Address changePasswordFromAddress=Updated Password From Address orderConfirmationFromAddress=Order Confirmation From Address orderShippedFromAddress=Order Shipped From Address promotionEmailAddress=Promotion From Address registeredUserFromAddress=Registered User From Address billableCountries=Billable Country Codes shippableCountries=Shippable Country Codes nonBillableCountries=Nonbillable Country Codes nonShippableCountries=Nonshippable Country Codes
SQL for adding crs_site_attribute to the publishing schema
This example shows the SQL for adding the crs_site_attribute
table to the publishing schema.
create table crs_site_attribute ( asset_version number(19) not null, id varchar2(40) not null, resource_bundle varchar2(254) null, prod_threshold number(10) null, page_size number(10) null, css_file varchar2(254) null, large_site_icon varchar2(254) null, default_country_code varchar2(2) null, emailafriend number(1) null, backinstock_addr varchar2(254) null, newpass_addr varchar2(50) null, orderconfirm_addr varchar2(50) null, ordershipped_addr varchar2(50) null, changepass_addr varchar2(50) null, registereduser_addr varchar2(50) null, promo_addr varchar2(50) null ,constraint crs_site_attr_p primary key (id, asset_version) );
SQL for adding crs_site_attribute to the switchingA and switchingB schemas
This example shows the SQL for adding the crs_site_attribute
table to the switching schemas.
create table crs_site_attribute ( id varchar2(40) not null, resource_bundle varchar2(254) null, prod_threshold number(10) null, page_size number(10) null, css_file varchar2(254) null, large_site_icon varchar2(254) null, default_country_code varchar2(2) null, emailafriend number(1) null, backinstock_addr varchar2(254) null, newpass_addr varchar2(50) null, orderconfirm_addr varchar2(50) null, ordershipped_addr varchar2(50) null, changepass_addr varchar2(50) null, registereduser_addr varchar2(50) null, promo_addr varchar2(50) null ,constraint crs_site_attr_p primary key (id) );