Skip to main content
All CollectionseCommerce
Adding Dynamic Content Objects
Adding Dynamic Content Objects

This article outlines how to add a dynamic content object to your website.

Isobel Honour avatar
Written by Isobel Honour
Updated over 2 years ago

Dynamic content objects are content objects that can change their output based on the activity of a plugin on the page. For example, if you have a product item plugin on the page, you can use a dynamic content object to output the name of the product in the header of the page as the title.

In order to handle situations where a dynamic content object is not updated by a plug-in, a default string can be entered which will appear instead.

Please note: Dynamic content objects are only supported in the .net gateway. Older sites still using Jaguar servers will need to be migrated before they are able to use this.

Syntax

The syntax for adding a dynamic content object to the page is shown below:

(CMS_DYNAMIC_KEYWORD:"Default text")

In this example, a fictional content object called "CMS_DYNAMIC_KEYWORD" is displayed on the page. If no plugin on the page provides content for an element of this name, the words "Default text" will appear in this location instead.

Advanced Use

Object Nesting

Standard system objects will resolve before dynamic objects, which allows you to do the following:

(CMS_DYNAMIC_PAGETITLE:"(CMS_PAGE_TITLE)")

Here we've used the system placeholder for the page title as the default text. The result of this will be that if a plugin produces the element "CMS_DYNAMIC_PAGETITLE" then this will be displayed at this location, otherwise the standard CMS page title for that page will appear.

HTML in Default Values

The terminating character combination is a quote followed by a bracket. This means that any HTML can be entered into the default value of a dynamic object, as long as it doesn't contain this symbol combination. For example:

YOU PAY (CMS_DYNAMIC_ITEMYOURPRICEVAT:"")!!!

In the above example, a div has been placed on the page with the class of "pricetest" and it's been given a style that makes it stand out. The content of the div contains a dynamic CMS object with a default value that outputs a style rule that hides the div.

The result of this is that if the "CMS_DYNAMIC_ITEMYOURPRICEVAT" element is generated by a plugin on the page, this will be displayed in a highlighted div. If this is not generated on the page, the entire div will be hidden by the style element in the default string.

Supported Elements

Below is a list of plugins that produce dynamic content object data.

Standard eCommerce

Product Item List/Detail

Element Name

Description

CMS_DYNAMIC_PAGETITLE

In the list view, returns the category description. In the detail view, returns the product description.

CMS_DYNAMIC_ITEMREF

Returns the item reference in the detail view

CMS_DYNAMIC_ITEMEXDESC

Returns the item extended description in the detail view

CMS_DYNAMIC_ITEMSPEC

Returns the item specification in the detail view

CMS_DYNAMIC_ITEMLINEPRICE

Returns the item line price excluding vat in the detail view

CMS_DYNAMIC_ITEMLINEPRICEVAT

Returns the item line price including vat in the detail view

CMS_DYNAMIC_ITEMYOURPRICE

Returns "your price" excluding vat in the detail view

CMS_DYNAMIC_ITEMYOURPRICEVAT

Returns "your price" including vat in the detail view

CMS_DYNAMIC_ITEMSTOCK

Returns the stock level in the detail view

Basket

Element Name

Description

CMS_DYNAMIC_BASKETQUOTENO

Returns the quote number of the basket

CMS_DYNAMIC_BASKETNETVALUE

Returns the net value of the basket

CMS_DYNAMIC_BASKETGROSSVALUE

Returns the gross value of the basket

CMS_DYNAMIC_BASKETTOTALLINES

Returns the total number of lines in the basket

CMS_DYNAMIC_BASKETTOTALITEMS

Returns the totalnumber of items in the basket

XML Syntax for Third Party Plugin Development

Please note: Not yet fully supported

 <dynamicObjects>
<Object name="CMS_DYNAMIC_OBJECTNAME" overrides="1"><![CDATA[Data]]></Object>
</dynamicObjects>

Name: The name of the dynamic object

Overrides [OPTIONAL]: 1 if this object should override other dynamic objects with the same name if the plugin executes later on the page. If this attribute is omitted or set to 0, the first object with this name will take priority.

Did this answer your question?