Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Tag definitions

Tag definitions

A tag definition contains information about a tag (name, description, tag value type, etc.). Before you create the tag definition, you need to decide what Tag value types the tag is going to be storing. Also, if you need to display the tag in a Using the Condition Builder UI widget in the CM, you also need to add the tag to a Tag groups.

The following SQL inserts a tag definition row into the TTAGDEFINITION table.

insert into TTAGDEFINITION(uidpk, guid, name, description, tagvaluetype_guid, taggroup_uid)
    values(22, 'CUSTOM_TAG_1', 'Custom 1', 'A custom tag', 'text', 5);

The tagvaluetype_guid must contain the GUID of an existing Tag value types. The taggroup_uid can be null or may contain the UIDPK of an existing Tag groups

The tag's display name can be localized by adding localized strings to the TLOCALIZEDPROPERTIES table. The following SQL inserts English and French display names for a tag definition into the TLOCALIZEDPROPERTIES table.

insert into TLOCALIZEDPROPERTIES (UIDPK,LOCALIZED_PROPERTY_KEY,VALUE,TYPE,OBJECT_UID)
    values (50062,'tagDefinitionDisplayName_en','Custom tag 1','TagDefinition',22);

insert into TLOCALIZEDPROPERTIES (UIDPK,LOCALIZED_PROPERTY_KEY,VALUE,TYPE,OBJECT_UID)
    values (50063,'tagDefinitionDisplayName_fr','Mot-clé 1','TagDefinition',22);
  • LOCALIZED_PROPERTY_KEY must be set to tagDefinitionDisplayName_ followed by the locale code.
  • TYPE must be set to TagDefinition.
  • OBJECT_UID must be set to the UIDPK of the tag definition row.

After a tag is defined, you need to add it to at least one tag dictionaries. The following SQL adds a tag to the tag dictionary whose GUID is CUSTOM:

insert into TTAGDICTIONARYTAGDEFINITION(tagdictionary_guid, tagdefinition_guid)
	values('CUSTOM', 'CUSTOM_TAG_1');