Book a call

Fill out the form and we will call you back as soon as possible

Emergency situation

In case of emergencies or breakdowns, you can send an SMS to our emergency hotline

On-call phone (SMS only)

+45 29 70 15 95

Send an SMS with the following information:

  • Your name and webshop
  • Description of the problem
  • Your callback phone number

Notes: This service is only for critical situations where your webshop is down or has serious problems. For regular support, please use our normal support channels.

Variables in a Shoporama theme

Overview of global and page-specific Smarty variables available in Shoporama themes.

Reading time: approx. {eight} minutes
Developer

There are generally two types of variables in Shoporama themes: global variables that are present on all pages and variables that are only present on selected pages. The global ones will be variables such as basket content, while the others will be the landing page or the product being displayed. Below is a list of variables that are present when templates are run via the web, i.e. not in emails.

If the variable contains an object, the methods on the object can be found in our overview of the template API.

In general, we also recommend that you take a look at our Alaska theme, which is freely downloadable and contains examples of how the following works.

Global variables

$webshop, the webshop being displayed.

$inc, the type of page being run. The values for this can be also, search, basket, address, shipping, approve, payment, thanks, order, product_review, subscription, blog, user-sign-up, user-sign-in, user-sign-out, user-edit, user-reset-password, user-profile, user-orders, user-subscriptions, user-change-card.

$shipping, the selected shipping.

$frontpage, if a static page is selected as the front page.

$pager_array, if the page being displayed contains pagination. Content is max, current, total, url, first_url.

$pager, pager object.

$current_url, the absolute url of the page being displayed.

$top_url, current relative url.

$get, $post, $cookie. An array containing the values of GET, POST and COOKIE respectively.

$user_id, user id if the customer is logged in.

$customer, the customer if logged in.

$remote_addr, the ip address of the customer.

$selected_payment_gateway, the id of the selected gateway.

$join_mailinglist, whether the customer has marked that they want to join the newsletter.

$basket_url, the url of the basket and its contents.

$campaign_ids, id's of campaigns if the products in the basket match a campaign.

$campaigns, if there is an active campaign.

$campaign_discount, the discount from the active campaigns.

$campaign_matches, an array of products that match a campaign. If there are no products, the variable is null.

$unpaid_order, if the customer (via closed cart) has an unpaid order.

$unpaid_recurring_order, unpaid subscription.

$basket, the contents of the basket as an array, where the individual elements are the products in the basket, with the values:

id, unique id of the line

product_id, the id of the product

in_stock, true/false if the product is in stock

product, the product

attributes, attributes of the product

own_id, the sku number

amount, the amount in the basket

comment, comment if applicable

bundle, array of the product if the product is a bundle

$subscriptions, the basket subscriptions.

$price, the subtotal of the cart contents.

$shipping_price, the shipping price.

$total_price, the total price of the cart contents.

$vat, the VAT on the basket contents.

$basket_weight, the total weight of the basket (for e.g. shipping).

$total_amount, the total number of products in the basket.

$voucher, the discount code if there is one.

$voucher_discount, the discount from the discount code.

$shipping_country, the selected shipping country.

$nofollow, true/false depending on whether nofollow is set on the page.

$meta_title, the title of the page.

$meta_description, description of the page.

$canonical, url of canonical.

$session_order, array with the billing address.

$session_del, array with the shipping address.

$session_extra, array with extra fields on the order. If a field with extra[test]=123 is posted, $session_extra.test will be 123 and will be stored on the order.

Variables per subpage

Naming files in a Shoporama theme is optional. However, some files are required, e.g. there must be a global.html, which is responsible for the execution of all other files. The actual content of the page is in $contents, and that content comes from index.html. If you don't use our Theme Builder, index.html will typically have to check what type of page is displayed and then display the content. For example:

<{if $product}> <{include file="product.html" product=$product}> <{/if}>

product.html will subsequently display the product. A classic setup would be:

<{if $inc}> <{include file=$inc}> <{elseif $category}> <{if $category->isFront()}> <{include file="front.html" category=$category}> <{else}> <{include file="category.html" category=$category}> <{/if}> <{elseif $landing_page}> <{include file="landing_page.html" landing_page=$landing_page}> <{elseif $product}> <{include file="product.html" product=$product}> <{elseif $page}> <{include file="page.html" product=$page}> <{elseif $blog_post}> <{include file="blog_post.html" product=$blog_post}> <{/if}>

Note that $inc is a bit special because it is the one that executes basket.html if you are in the basket.

If Theme Builder is used, the theme must first be written in Bootstrap, then it must include an additional file called default_contents.html, which has the same content as index.html previously had. Index.html should now contain the following:

<{if $tb_contents}> <{$tb_contents}> <{else}> <{include file="default_contents.html"}> <{/if}>

Where $tb_contents is the content from Theme Builder.

Shipping

$shops, available shipping shops.

$shipping_module, the name of the shipping module. For example, gls.

$xml_url, url for shipping shop lookup, if available.

$no_shops, true/false depending on whether there are available shipping shops.

$bird_delivery, true/false. Whether Burd delivery is available at the selected delivery address.

Address

No variables other than the global ones.

Approve

No variables other than the global ones.

Also

$product, the product just added to the cart.

Blog

$blog_posts, array of blog posts.

Blog post

$blog_post, the blog post being displayed.

Category

$category, the category being displayed.

$products, array of products.

Front

$category, the category.

Landing page

$landing_page, the landing page being displayed.

$meta, array of extra fields

$products, array of products.

Page

$page, the static page being displayed.

Product

$product, the product being displayed.

$meta, array of extra fields

Order

$order, the order.

Product review

$order, the order being reviewed.

Search

$products, array of products.

$landing_pages, array of landing pages.

$categories, array of categories.

$count, number of results.