What is Raptor?

Raptor is proprietary to Aptos Digital Commerce and allows visual functionality to be added to HTML pages through the site manager. By utilizing the template auto-populate functionality in the editor, items like slideshows and pagination can be dropped into a page without the need for excessive programming.

You can access templates, css and js for your site through the Site Manager at Content > Pages > Templates. It is advisable to utilize the editor within this section to maintain an audit trail. Developers should be familiar with HTML and Scripting concepts.

Understanding Field, Function, and Cache Nodes

There are three types of nodes that are parsed by the Aptos Digital Commerce platform. These nodes are: fields, functions and caches.

Field Nodes
Example: Featured Content Block The field below will output the FeaturedContent (Featured Content Block) for the Mobile (Group Mobile) with the title "Header-Links".

<field type="FeaturedContent.Mobile.Header-Links" /> Example: Sells For Price This field will output the current Product.Sale (Sells For) price of the product formatted as currency.

<field type="Product.Sale" formatter="currency" /> Multiple fields can be used in a template and they can be used both with, and without, functions.

Function Nodes
Function nodes allow for more advanced types of content. These can be anywhere from comparisons and calculations, to looping through results of data. A function can have multiple attributes associated with it depending on the specifics for the function you are working with.

Example: Comparing Sale v. On Sale Pricing This function type shown below (Custom.Compare), compares the database Value1 for Product.Sale (Sells For) with Value2 Product.Sale_Special (On Sale) pricing for the product.

<function type="Custom.Compare" Value1="Product.Sale" Value2="Product.Sale_Special">
So, if the Value1 Product.Sale, is greater than or equal to Value2, it will use template.

<function type="Custom.Compare" Value1="Product.Sale" Value2="Product.Sale_Special"> <template> <span id="displayAmount"><field type="Product.Sale_Special" formatter="Currency" /></span> </template>

If Value1 is less than Value2, it will use the elsetemplate. It will then replace the content within the node it is using and will parse any fields or functions within that node.

<function type="Custom.Compare" Value1="Product.Sale" Value2="Product.Sale_Special"> <elsetemplate> <span class="regular"><field type="Product.Sale" formatter="Currency" /></span> </elsetemplate> </function>

Function Loops
Loops are even more advanced functions. They enable more precise specifications for the fields being called. In short, they guide the way.

Example: Looping through Sub-Categories under a Category This is an example of a loop placed on a Category page. It will loop through the Sub-Categories which are directly under the category.

In this function, the content for template is used for each of the Sub-Categories which reside under the Category. Some of the data that is being replaced are fields associated with the Sub-Category.

The content in href is listed as <field type="SubCategory.SubCategoryUrl" /> for example. This is done in this manner to ensure it is XML compliant and will be replaced while looping the content.

<function type="Category.SubCategory.Loop" mobileOnly="true" sortOrder="DeptOrder,Dept_Alt"> <template> <li><a title='<field type="SubCategory.Dept_alt" />' href='<field type="SubCategory.SubCategoryUrl" />'><field type="SubCategory.Dept_alt" /></a></li> </template> </function>

Cache Nodes

Available Attributes
cacheName - Required. The cacheName must be unique across all templates.
cachePageSpecific - When true, pages sharing the same template will each have their own cached data; otherwise, cache will be shared across pages
cacheTierSpecific - When true, cache will be saved based on the user's tier; otherwise, all tiers will see the same cached content.
custom - Comma separated list of query string parameters. Use when cached content on the page needs to change in conjunction with query strings.
Cache nodes are used for caching full blocks of HTML. A cache node might look like the example shown below.

By wrapping fields in the cache node, it ensures the lookup will not repeat on each of those fields after the first time the page is opened. As you can see below, cache nodes can contain both fields and functions and will cache all the content after it has been parsed to allow for the best performance.

<cache cacheName="homePageContent">
   <div id="left_nav" class="basewrap">
   <function type="Include" file="searchbox2.htm" />
   <field type="FeaturedContent.Homepage.LeftNav" />
   <field type="FeaturedContent.Homepage.LN1" />
   <field type="FeaturedContent.Homepage.LN2" />
   <field type="FeaturedContent.Homepage.LN3" />

Cache Expiry
Cache will expire in 2 days by default. You can override this behavior by using cacheExpiry attribute.

<function type="Category.SubCategory.Loop" cacheExpiry="1d6h30m">

In this case the cache for this function will expire in 1 day, 6 hours and 30 minutes.

Working with CDATA
CDATA is very useful when working within JS to loop and output JS variables using Raptor as JS is not proper XML.

<function type="Custom.Contains" Value1="Request.URL.PageName" Value2="cart.aspx">
<![CDATA[ <script type="text/javascript"> //_ltk.SCA.Stage = 1;]]>
<function type="Cart.Loop" max="#" sortOrder="Row_ID Asc" > <template>
//<Unable to render embedded object: File ([CDATA[_ltk.SCA.AddItemWithLinks(']]><field type="Cart.Part_No" /><) not found.[CDATA[', ']]>
<field type="Cart.Quantity" /><Unable to render embedded object: File ([CDATA[', ']]><field type="Cart.Total" /><) not found.[CDATA[', ']]>
<field type="Cart.ProductName" /><Unable to render embedded object: File ([CDATA[', '/images/t09fa.jpg', ']]>
<field type="Cart.Original_URL" /><) not found.[CDATA['); // one line per item]]>
</function> <![CDATA[//_ltk.SCA.Submit(); </script> ]]>
</template> </function>