Twig Templating Engine Docs

*Note: If you notice any issues with your site or listings, switch back to the default template until you have fixed the issue.

Please refer to the Twig documentation for further explanation on how the templating language works:

How To: Download the default template files and create a new template

  1. Login to SureDone
  2. Go to Settings > Templates
  3. Press 'default'

  4. Click 'Download All’ to download all of the assets of the template
  5. Alter the files as you wish to make your template work
  6. Go back to Settings > Templates
  7. Click on the template you created
  8. Upload the files then press Save Settings

  9. To use your template, go back to Settings > Templates and select it from the dropdown and be sure to check the confirm box before pressing Save Settings

SureDone Twig Tags Summary:

template engine open and close tags
{% %}

comment open and close tags
{# .... #}

output a variable open and close tags
{{ }}

set a variable example
{% set varname = 'my custom text' %}

if else logic example
{% if varname == 'hello' %} say {{ varname }} {% else %} say goodbye {% endif %}

include file in template
include 'localfile.htm'

SureDone Template Style and Script Testing:

Because SureDone uses a CDN to deliver all image, script, and css assets for high performance, we recommend that you use embedded CSS and Javascript while developing your template in order to avoid caching issues during development.

For example, if you created a template file named "custom.htm" and use the HTML <style> and <script> tags to embed your CSS and Javascript in that file. Then, include that file in the HTML HEAD of your template.

Once you've completed testing, you can create external CSS and Javascript files and use the appropriate <link> and <script> tags to include those files in your template.

The CSS and Javascript files can then be uploaded to the asset manager at!/assets which will display the url to include.

When including the url, we recommend considering if the asset will be used on any secure pages that use SSL (such as checkout, or a contact form). For assets that will be included on secure pages, you can change the url from to to ensure they are securely delivered to the end user.

SureDone Custom Functions:

return SureDone option value
format: sd_option(option_name)
{{ sd_option('business_name') }}

return url block etc formatted example

list of sd_siteinfo options
url, business, business_url, business_email, title, description, logo, logo_secure, logo_url, logo_secure_url, facebook, facebook_url, twitter, twitter_url, youtube, youtube_url, google_adsense, google_analytics, google_verification, microsoft_verification, yahoo_verification, releases_feed, releases_feed_url, products_feed, products_feed_url, pages_feed, pages_feed_url, galleries_feed, galleries_feed_url, categories_feed, categories_feed_url, googlebase_feed_url, stylesheet, stylesheet_url, stylesheet_admin, javascript, javascript_url, javascript_admin, favicon, favicon_url, appletouchicon, appletouchicon_url, site_search, charset, jquery, jquery_url, jqueryui, jqueryui_url, jquerytools, jquerytools_url, jquerycss, jquerycss_url, tinymce, tinymce_url, tinymcejs, tinymcejs_url, facebookjs, version, version_api, version_logo, version_logo_secure, version_logo_url, version_logo_secure_url, version_logo_white, version_logo_secure_white, version_logo_url_white, version_logo_secure_url_white, version_favicon, version_favicon_url, version_appletouchicon, version_appletouchicon_url, version_logo_powered, version_logo_powered_secure, version_logo_powered_url, version_logo_powered_secure_url, version_logo_powered_link, version_text_powered_link

show content blocks example
format: sd_content(view, display=true)

list of content block views
price, price_discount, description, title_link, category_link, gallery_link, media_main, media_thumbs, media_images, cart_details, shipping_details, long_description, item_details, date, content, media_gallery, buy_now_button, buy_now_price, related_item_link, cat_children, cat_breadcrumbs, cat_nav_menu, tags, release_preview, releases, page_index, newest_blogs, terms_policy_default, long_description_options, description_details, orders_results, facebook_button, twitter_button, pinterest_button, googleplus_button, results

set a formatted storefront url example
format: sd_seturl('my-url-slug',url_type,url_path='absolute',url_ssl=false)
{{ sd_seturl('my-category','category') }} - outputs

list of url types

set a secure image url example
format: sd_securemedia(url)
{{ sd_securemedia('') }} - outputs

return large size product image available example
format: sd_getmediafull(url)
{{ sd_getmediafull('') }} - outputs

return smallest size product image available example
format: sd_getmediathumb(url)
{{ sd_getmediathumb('') }} - outputs

return currency symbol of storefront example
format: sd_currency(display=true)
{{ sd_currency(false) }}499.99 - outputs '$499.99'

return full country name from two letter ISO code example
format: sd_countryname(countrycode)
{{ sd_countryname('US') }} - outputs 'UNITED STATES'

return full state or province name from two letter US State or CA Province abbreviations
format: sd_statename(code)
{{ sd_statename('CA') }} - outputs 'California'

return storefront user
sd_getaccount(id, email)

return shopping cart contents example
{% set mycart = sd_cart() %} {{ dump(mycart) }}

return shopping cart totals example
{% set carttotals = sd_carttotals() %} {{ dump(carttotals) }}

return shopping cart dimensions example
{% set productdimensionsincart = sd_cartdimensions() %} {{ dump(productdimensionsincart) }}

return shopping cart system labels
format: sd_carttotalslabel(labeloption)

list of shopping cart label options
subtotal, shipping, handling, tax, discount, total

return product results from search example
format: sd_getresults(searchquery, state, limit, sort, page, status, full=false)
{% set products = sd_getresults('color:blue', 'both', '20', 'price_', '2', 'sale') %}
{{ dump(products) }} - if there were 80 available products meeting criteria color=blue on the storefront
would dump out products in stock or active, page 2 of these products, in descending order by price, and both parents and children

product results search state options
active (returns only state=active)
stock (returns products with stock)
both (returns products with state=active or in stock) sale (returns any type of product)

product results search status options
publish (returns only published parents)
sale (returns product parents and children)
return date example
format: sd_date(display=true,date_type='new')
{{ sd_date(false) }}

list of date types
new (newest of date added/updated)
date (date added)
dateupdated (date updated)

return formatted date example
format: sd_datetext(date,display=true)
{{ sd_dateText('2016-03-01',false) }} - output March 1st, 2016 (based on format set in settings)

return if product/page has ever been updated
format: sd_lastupdated(date)

return date time based on timezone
format: sd_localtime(date_time)

return item/page/category identifier

return canonical page url

return next url and title
sd_next_url() sd_next_title()

return previous url and title
sd_prev_url() sd_prev_title()

return error/success/notice messages

return most recent pages in a set example
format: sd_getnewpages(page_name, page_search, page_limit, page_sort)
{% set newblogs = sd_getnewpages('blog','date:>2016-03-01','7') %}
{{ dump(newblogs) }} - outputs dump of 7 new blogs created after March 1st, 2016

return GET parameters from the url example
format: get_reqs(var)
{{ get_reqs('testvariable') }} - outputs 'hello'

return GET 'do' parameter from url example
{{ get_do() }} - outputs 'this'

return current UTC time

return substring of string

return json decode of string

return json encode of string

return regular expression check
preg_match(regex, string)

return regular expression replacement
preg_replace(regex, replace, string)

return unique values from twig array

return is twig array check

return is integer check

return UNIX timestamp from date time

special variables
output => storefront special variables
output variables => doaction, cart, form_data, orders, newest_blogs, buttons, icons, results, items_html, next_url, next_title, prev_url, prev_title, notice_html, verified_html, support_html, feedback_html, returns_html, contact_html, legal_html, accounts_html, helpform_html, cart_html, cart_total, search_html, releases_html, galleries_html, sitemap_html, emaillist_html, home_uri, accounts_uri, helpform_uri, cart_uri, cart_suri, search_uri, search_suri, releases_uri, galleries_uri, sitemap_uri, contact_uri, legal_uri, page, sort, canonical, domain, categorytitle, details_labels, details_labels_displayed, cat_breadcrumbs, cat_breadcrumb_urls, cat_breadcrumb_text, cat_children_labels, cat_children_display, cat_children_urls, cat_children_text, cat_children_desc, cat_nav_menu, cat_nav_menu_heading, group, sorting, sorting_labels, releases, release_preview, accounts_sorting, accounts_sorting_labels, search_fields, cart_totals_labels, shipping_services_labels, request_uri, instanceid, buttons, icons, details_labels, details_labels_displayed, shipping_services_labels

orders => number of orders based on context where this is used

data => product/page/category/etc variables
data variables => id, uri, galleryuri, parenturi, sku, guid, stock, price, reprice, price_range, discountprice, user_price, msrp, featured, price_discount, price_discount_percent, instanceid, name, title, keywords, description, longdescription, content, notes, htmltitle, metadescription, metarobots, geolocation, size, color, condition, brand, style, upc, tags, media_titles, shipping, shippingadditional, handlingfee, weight, dimweight, boxlength, boxwidth, boxheight, boxweight, date, dateupdated, asset, rule, state, status, active, type, total_stock, googleshopping, googleshopurl, googlecategory, category1, category2, category3, category4, category5, media1 - media10, mediax, mediacount
products pages only: user custom fields
categories only: navtitle, level, group, customparams, customparamsrel

sd_is_mobile => device accessing page is mobile

sd_is_admin => is admin logged in

sd_is_logged_in => is customer logged into shopping cart

sd_is_secure => is secure endpoint,

sd_is_cart_set => is shopping cart not empty,

sd_is_get => special GET vars set: call, page, sort, view, q, group, type, do, update, order, form, preview, download, all, show

is_sd_preview => is store admin logged in preview when site live is off

is_ie_check => is internet explorer check

is_ga_suredone => is SureDone domain Google Analytics or not

is_secure_services => for custom domains to switch from non-ssl to ssl cart/accounts/contact

is_custom_icon => is user defined custom icon directory

sd_function_last => SureDone last function for shopping cart/accounts

sd_request_uri => request uri

sd_ga_tracksearch => Google Analytics search tracking code,
sd_ga_tracking_code=> Google Analytics ecommerce conversion tracking code,

sd_cart_uri_ssl => secure cart url

sd_acct_uri_ssl => secure accounts url

sd_search_uri => search url

sd_search_uri_ssl => secure search url

sd_feed_links => rss feeds for storefront products/pages/categories

sd_store_favicons => favicon/appletouchicon

sd_store_javascripts => storefront jquery/js/fb/widgets

sd_store_stylesheets => storefront css and widget css

sd_store_verifications => google/yahoo/microsoft site verifications tags

sd_session_id => system session_id

sd_server_name => storefront server name (domain name)

sd_login_info => logged in storefront user info

default template main files

swap legacy template tags example
{% set sdfootercustom = sd_option('site_custom_footer') %}

legacy template tags
,view cart,,service,,,,contact,
,, ,,,,,26,030,702,,,feedback,returns, 877-773-6755,SureDone,,,

show legacy formtypes
format: sd_formtype(form_name, form_data, multi_array=false, override=false)
multi_array with value of true will not sanitize data
override with value of true will return form (used for forms within forms)
most of the form names below have been converted to individual files that may be included

formtype form names
HideShipping, StateProvOptions, CountryOptions, WWWCartBilling, WWWCartShipping, WWWUserBilling, WWWUserShipping, USCACartBilling, USCACartShipping, INTLCartBilling, INTLCartShipping, USCAUserBilling, USCAUserShipping, INTLUserBilling, INTLUserShipping, AccountForm, AccountLoginForm, CheckoutForm, AdaptiveForm, CardCheckout, PayPalCheckout, CartEmail, CartPass, UserEmail, UserPass, BillingName, BillingAddress, ShippingName, ShippingAddress, BusinessAddress, CartLoginForm, ServiceForms, ReturnForm, SupportForm, FeedbackForm, ServiceProcessed, ServiceEmail, FeedbackEmail, VerificationEmail, LoginAssistEmail, InvoiceEmail, ShipTrackingEmail, CartBillShipTo, CartSummary, CartConfirmed, CheckoutConfirmed, CartTotals, ShippingServices, CartContents, CartProgress, OrderInvoice, PackingSlips, InvoiceNav, PickList, PickListOrder, CartPostSale