Templating objects

Website personalisation: Templating

Objects are data items that contain dynamic attributes and values to output to a page or template.

Titles

The titles object is a collection of titles.

It's a common object that is normally available as a child object for many other objects.

For example, the product object has a titles child object which can be accessed via product.titles.

The titles object has the following properties:

titles.default

By convention, the titles object always has a "default" property.

This is the main or default title.

titles.*

There is no limit to the number of values a titles object can have.

To access additional titles simply reference them by name:

<h1>{{ product.titles.default }}</h1>
<h2>{{ product.titles.alt1 }}</h2>
<h3>{{ product.titles.alt2 }}</h3>

When rendered this would produce an output such as:

<h1>Red T-Shirt</h1>
<h2>Red Cotton T-Shirt</h2>
<h3>Sports T-Shirt</h3>

abstracts

The abstracts object is a collection of abstracts.

It's is a common object that is normally available as a child object for many other objects.

For example, the product object has an abstracts child object which can be accessed via product.abstracts.

The abstracts object is typically available on all lists and all detail pages.

Abstracts typically contain HTML tags within their values, although this is optional.

The abstracts object has the following properties:

abstracts.default

By convention, the abstracts object always has a "default" property.

This is the main or default abstract.

abstracts.*

There is no limit to the number of values an abstracts object can have.

To access additional titles simply reference them by name:

{{ product.abstracts.default }}
{{ product.abstracts.delivery }}
{{ product.abstracts.condition }}
{{ product.abstracts.instructions }}

When rendered this would produce an output such as:

<p>Blue denim trousers in the latest style.</p>
<p>Normally takes <em>3</em> working days.</p>
<p>Good condition, never used.</p>
<p>Machine washable.</p>

descriptions

The descriptions object is simply a collection of descriptions.

It's a common object that is normally available as a child object for many other objects.

For example, the product object has a descriptions child object which can be accessed via product.descriptions.

The descriptions object is only available on detail pages.

So, for products, product.descriptions is only available on the product detail page.

For categories the category.descriptions object is only available on a category page.

Descriptions typically contain HTML tags within their values, although this is optional.

The descriptions object has the following properties:

descriptions.default

By convention, the descriptions object always has a "default" property.

This is simply the main or default description.

descriptions.*

There is no limit to the number of values a descriptions object can have.

To access additional titles simply reference them by name:

{{ product.descriptions.default }}
<hr/>
{{ product.descriptions.facts }}
<hr/>
{{ product.descriptions.instructions }}

When rendered this would produce an output such as:

<p>Luxury printed wallpaper made to the finest standard.</p>
<p>Made from quality recycled wallpaper.</p>
<hr/>
<ul>
   <li>Class A fire-rated</ul>
   <li>Size: 28 in by 28 ft</ul>
   <li>Finish: fade resistant, water resistant</ul>
   <li>Color: faded green</ul>
</ul>
<hr/>
<div>Watch our step by step <a href="#">video guide</a>.</div>

media

The media object represents a collection of properties relating to images or other media items.

It's a common object that is normally available as a child object for many other objects.

For example, the product object has a media child object which can be accessed via product.media.

The media object has the following properties:

media.default

By convention, the media object always has a "default" property.

This is the main or default media.

Child objects

Within each media object (e.g. media.default) there are sub objects which will be specific to the media type.

For example an image might have src, width and height whereas a video src and controls:

<img src="{{ product.media.default.src }}" width="{{ product.media.default.width }}" height="{{ product.media.default.height }}" />

media.*

There is no limit to the number of values a media object can have.

To access additional titles, reference them by name:

<img src="{{ product.media.default.src }}" width="{{ product.media.default.width }}" height="{{ product.media.default.height }}" alt="{{ product.media.default.alt }}" />

<img src="{{ product.media.alt_image.src }}" width="{{ product.media.alt_image.width }}" heig

pricing

The pricing object is a common object that is normally available as a child object for many other objects.

📘

Note

Prices should be used in conjunction with the money filter to display correctly.

The pricing object has the following properties:

PropertyDetails
pricing.priceReturns the main price of an item.
pricing.wasReturns the "was" price for an item.
pricing.rrpReturns the recommended retail price price for an item.
pricing.costReturns the cost price for an item.

product

The product object has the following properties:

PropertyDetails
product.idReturns the ID of the product.
product.skuReturns the sku for the product.
product.titlesReturns a titles object.
product.abstractsReturns an abstracts object.
product.descriptionsReturns a descriptions object.

Note: The descriptions object is only present in a product detail page.
product.mediaReturns a media object.
product.pricingReturns a pricing object.
product.min_pricingOptional.

Returns a pricing object.
product.max_pricingOptional.

Returns a pricing object.
product.slugReturns the URL slug for the product.
product.canonical_urlReturns the canonical (default) URL of the product.
product.urlReturns the URL for the product.

Note: If a product has multiple urls then Ometria calculates the correct URL to use depending on the context.

Facet

The facet object has the following properties:

PropertyDetails
facet.idReturns the ID of the facet.
facet.titlesReturns a titles object.
facet.abstractsReturns an abstracts object.
facet.mediaReturns a media object.
facet.data_typeReturns the data type for the facet.
facet.field_typeReturns the field type for the facet.
facet.selectedReturns true if the facet has any items that have been selected.

Filter

The filter object has the following properties:

PropertyDetails
filter.idReturns the ID of the filter.
filter.titlesReturns a titles object.
filter.abstractsReturns an abstracts object.
filter.mediaReturns a media object.
filter.typeReturns the type for the filter.