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, which are present on all pages, and variables that are present only on selected pages. Global variables include, for example, the contents of the shopping cart, while others might include the landing page or the product being displayed. Below is a list of variables that are available when templates are rendered on the web—that is, not in emails.

If a variable contains an object, the methods available for that object can be found in our overview of the template API.

In general, we also recommend taking a look at our Alaska theme, which is available for free download and includes examples of how the following works.

Shoporamas kodeeditor med filliste over MBN-Delaware-temaets template-filer og koden fra after_purchase.html åben til redigering.
The code editor under “Theme,” where the theme’s template files are edited. The file list on the left shows all the theme’s files, and the editor on the right displays and edits the code in the selected file.

Global variables

$webshop, the webshop being displayed.

$webshop->getNewsletters($limit, $offset, $count, $sort), the store’s publicly shared newsletters, used to build an archive. Each item is a SafeNewsletterCampaign object with methods such as getTitle(), getDate(), getExcerpt(), getImage(), getUrl(), and getContent(). Use $webshop->getLatestNewsletter() for the latest newsletter and $webshop->hasNewsletters() to check if any exist. Requires that the public newsletter archive be enabled under Newsletters.

$inc, the type of page being rendered. Possible values include 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 method.

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

$pager_array, if the page being displayed contains pagination. The contents are max, current, total, url, first_url.

$pager, pager object.

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

$top_url, the current relative URL.

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

The system automatically sets the following GET parameters:

  • payment_cancelled — set to 1 when a customer cancels or fails in the payment flow. Use $get.payment_cancelled to display an error message in your theme.

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

$customer, the customer if they are logged in.

$remote_addr, the customer’s IP address.

$selected_payment_gateway, the ID of the selected payment gateway.

$join_mailinglist, whether the customer has opted in to the newsletter.

$basket_url, the URL to the shopping cart and its contents.

$campaign_ids, IDs of campaigns if the products in the cart match a campaign.

$campaigns, if there are any active campaigns.

$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 a closed cart) has an unpaid order.

$unpaid_recurring_order: an unpaid subscription.

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

id, the unique ID of the line item

product_id, the product’s ID

in_stock, true/false indicating whether the product is in stock

product, the product

attributes, the product’s attributes

own_id, the SKU number

amount, the quantity in the cart

comment, any comments

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

$subscriptions, the cart's subscriptions.

$price, the subtotal of the cart's contents.

$shipping_price, the shipping cost.

$total_price, the total price of the cart's contents.

$vat, the sales tax on the contents of the cart.

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

$total_amount, the total number of items in the cart.

$voucher, the discount code, if any.

$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 page title.

$meta_description, the page description.

$canonical, the canonical URL.

$session_order, an array containing the billing address.

$session_del, an array containing the shipping address.

$session_extra, an array containing additional fields for the order. If a field is posted with extra[test]=123, $session_extra.test will be 123, and it will be saved with the order.

Variables per subpage

You can name files in a Shoporama theme however you like. However, some files are required; for example, there must be a `global.html` file, which handles the execution of all the other files. The actual content of the page is stored in $contents, and that content comes from index.html. If you’re not using our Theme Builder, index.html will typically need to check what type of page is being displayed and then display the corresponding content. For example:

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

product.html will then handle the display of 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’s the one that, for example, loads basket.html if you’re in the shopping cart.

If you’re using Theme Builder, the theme must first be written in Bootstrap, and it must also include an additional file named default_contents.html, which has the same content that index.html previously had. Index.html must 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 pickup locations.

$shipping_module, the name of the shipping module. E.g., gls.

$xml_url, URL to the pickup shop lookup, if available.

$no_shops, true/false depending on whether there are available pickup locations.

$bird_delivery, true/false. Indicates whether Bird 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 that was just added to the cart.

Blog

$blog_posts, an array of blog posts.

Blog post

$blog_post, the blog post being displayed.

Category

$category, the category being displayed.

$products, an array of products.

Front

$category, the category.

Landing Page

$landing_page, the landing page being displayed.

$meta, array of additional fields

$products, array of products.

Page

$page, the static page that is displayed.

Product

$product, the product being displayed.

$meta, array of additional fields

Order

$order, the order.

Product review

$order, the order being reviewed.

Search

$products, array of products.

$landing_pages, array of landing pages.

$categories, an array of categories.

$count, number of results.