Sign Up Login or

Template Contexts

Introduction

Contexts are collections of variables that can be accessed from the template. These collections can, for example be the store name, a list with products or the navigation menu.

Store Context

This context holds settings variables for your store and are accessible from every template.

Name Path Type Description Example
target target string Target for current page if available. "tags:men,bikes", "page:welcome"
settings settings dictionary
handle settings.handle string Store handle "myhandle"
status settings.status string Store status "maintenance", "offline"
logo settings.logo string Logo image url. Can be an image resource uuid, or a complete url. "06429e75a8ea11de80c09314b8ee4e52.png", "http://www.apple.com/media/logo.jpg"
currency settings.currency enum Store base ISO currency. For all possible currencies see constants. "USD", "EUR"
email settings.email string Store contact email "test@mygreatstore.com"
url settings.url string Base url for store "http://www.enstore.com/[store-handle]"
address settings.address string Store address
street1 settings.address.street1 string Street address "123, Broadway"
street2 settings.address.street2 string Street address line 2 "Apt 4 Building 8"
city settings.address.city string City name "New York"
zipCode settings.address.zipCode string Zip/Postal Code "90210"
stateCode settings.address.stateCode string State/Province Code "NY"
stateName settings.address.stateName string State/Province Name "New York"
countryCode settings.address.countryCode string Country Code "US"
countryName settings.address.countryName string Country Name "United States"
menus menus dictionary
navigation menus.navigation list with dictionaries
title menus.navigation.[index].title string Menu title "Books", "Discounted Items", "About Us"
target menus.navigation.[index].target string Menu link URL "page:welcome", "tags:books,magazines"
url menus.navigation.[index].url string Menu link URL "/[store-handle]/shop/browse/books/1", "/[store-handle]/shop/page/about-us", "http://www.apple.com"
submenus menus.navigation.[index].submenus list with dictionaries Submenus for this menu item. Submenus have the exact same structure as these menus.
product menus.product list with dictionaries
title menus.product.[index].title string Menu title "Magazines", "Discounted Items"
target menus.product.[index].target string Menu link URL "page:welcome", "tags:books,magazines"
url menus.product.[index].url string Menu link URL "/[store-handle]/shop/browse/books/1", "/[store-handle]/shop/page/about-us", "http://www.apple.com"
submenus menus.product.[index].submenus list with dictionaries Submenus for this menu item. Submenus have the exact same structure as these menus.
content content dictionary
intro content.intro string Welcome text. Can contain HTML or Textile contents. "Welcome to our lovely store"
footer content.footer string Text for the footer on all pages. Can contain HTML or Textile contents. "Copyright 2010 My Great Store"
Browse Page Context

This context is passed to the browse page. I contains a selection of products based on your parameters, and information to page through them. It also optionally includes a list of product variables if they are available.

Name Path Type Description Example
products products list List of products based on url parameters.
For product properties see the product resource documentation.
query query string Optional used search query for product list "test search"
tags tags array with strings Optional used tags for product list "men", "bikes"
sort sort string Optional sort property for product list "sku", "name", "price"
hasNextPage hasNextPage bool Wether there is a next page in the results true, false
hasPrevPage hasPrevPage bool Wether there is a previous page in the results true, false
nextPage nextPage integer The next page number in the results 1, 2, 3
prevPage prevPage integer The previous page number in the results 1, 2, 3
currentPage currentPage integer The current page number in the results 1, 2, 3
pageSize pageSize integer The number of products shown per page. 10, 12, 20
totalProductCount totalProductCount integer The total amount of products in the result. Not available with query parameter. 23, 500
totalPagesCount totalPagesCount integer The total amount of pages in the result. Not available with query parameter. 10, 20
Item Page Context

This context is added to the item page.

Name Path Type Description Example
product product dictionary Contains the product information to display on this page.
For product properties see the product resource documentation.
variationProducts variationProducts list with dictionaries Contains a list with all the variation products for the viewed product.
For product properties see the product resource documentation.
Custom/Welcome Page Context

This context is added to custom pages and the welcome page.

Name Path Type Description Example
content content dictionary Can contain extra content keys, but will contain "main" by default.
main content.main string Main content for pages. Can be plaintext, html or textile. "Lorem ipsum dolor sit amet, consectetur adipisicing elit."