Reads in the HTML file or free markup and prints its contents on a page.

Description

The tags that print lists also have the helper attribute that works almost in the same way as the {Helper} tag.

See also the instructions for formatting lists by using the helper attribute.

Syntax

{Helper(
    file: string,
    case: string,
    product: int,
    category: int,
    brand: int,
    campaign: int,
    infopage: int,
    news: int
)}

Scope

Required scope: globaali

Tags with global scope can be used on any template and in any tag.

Content reuse on multiple pages by using the {Helper} tag

<header>
    <div class="logo">
        {Logo}
    </div>
    <nav>
        {Categories}
    </nav>
</header>

The above file contains the header section used by every theme page, where the company logo and product category navigation are printed by using the {Logo} and the {Categories} tags respectively.

The file can be found in the theme folder helpers under the name header.html.

{Helper(
    file: 'helpers/header'
)}

The header.html file can be retrieved by using the above markup. Note that the file path indicated as the value of the file attribute doesn't contain the file extension.

Printing a single product by using the {Helper} tag

If you want to print the files of a single product by using the {Helper} tag, save the product tags that print the following product details in the file to be printed:

<div>
    <h2>{ProductName}</h2>
    <div>
        {ProductPrices}
    </div>
    <div>
        {ProductDescription}
    </div>
</div>

The sample file above is located in the theme folder /helpers under the name promotuote.html:

{Helper(
    file: 'helpers/promotuote',
    product: 6
)}

In such case, the selected product's ID number and the location of the file to be printed are indicated as the values of the product and file attributes of the {Helper} tag, respectively.

In the example, the tags in the file to be printed print details of the product whose ID number is 6.

Printing products belonging to a product category by using the {Helper} tag

Where necessary, you can use the {Helper} tag to print a list of products belonging to a selected category. In such case, you can use e.g. the {CategoryProducts} tag in the file to be printed to print the product list.

<div>
    <h2>{CategoryName}</h2>
    <div>{CategoryDescription}</div>
    <div>
        {CategoryProducts(
            helper: 'helpers/listproduct'
        )}
    </div>
</div>

The above HTML and Interface markup is saved in the helpers/promo-category.html file.

In the example, the tag that prints the list is used with the helper attribute, which is used for setting the contents of the helpers/listproduct.html file to print the markup of a single product included on the list.

{Helper(
    file: 'helpers/promo-category',
    category: 7
)}

The Interface markup prints the name, description and products of the product category whose ID number is 7.

Printing contents only for customers belonging to specific customer groups

The contents that should be available only to specific customer groups are saved to a separate file in the /helpers folder of the online store's theme.

<div>
    <h2>Only for resellers</h2>
    <p>This content is displayed only to logged in users who belong to the reseller customer group.</p>
</div>

The example contains only HTML contents but the file can of course contain Interface markup too.

{Helper(
    file: 'helpers/reseller-content',
    case: 'CustomerGroup-3'
)}

The contents are printed by using the {Helper} tag with 'CustomerGroup-n' as the value of the case attribute, where n is the ID number of the selected customer group.

Attribuutit

file:

Defines the file or markup to read in and print.

The value can be indicated in two ways:
  • Tiedostonimi: Enter the location of the HTML file in relation to the theme's root directory.

    Do not include the file extension in the filename.

  • Merkkaus: Surround the markup with double curly brackets: {{ <!-- HTML and Interface markup here --> }}.

For example:
{Helper(
      file: 'helpers/file'
)}

{Helper(
      file: {{
            {ShopName}
      }}
)}
case:

Defines the conditions under which the tag produces contents.

Allowed values:

  • 'CartNotEmpty': The shopping cart is not empty.
  • 'CartEmpty': The shopping cart is empty.
  • 'IsCheckout': The current page is a checkout page.
  • 'IsCategory': The current page is a product category page.
  • 'IsHomepage': The current page is the front page.
  • 'IsBrand': The current page is a brand page.
  • 'IsProduct': The current page is a product page. Additionally, the product page can use the following values:
    • 'IsNewProduct': The product has been published within last month.
    • 'IsDiscountProduct': The product belongs to an active campaign.
    • 'IsFeaturedProduct': The product is featured.
  • 'IsCampaign': The current page is a campaign page.
  • 'IsNews': The current page is a news page.
  • 'IsPage': The current page is a content page.
  • 'IsAccount': The current page is one of customer account pages.
  • 'AdminLogged': The visitor is logged in as an admin user.
  • 'CustomerLogged': The visitor is a logged in customer.
  • 'CustomerNotLogged': The visitor is not logged in as a customer.
  • 'CustomerGroups': The logged in customer belongs to a customer group.
  • 'CustomerGroup-n': The logged in customer belongs to the customer group n (the customer group's ID number).
  • 'IsNewCustomer': The customer's email address can be found in precisely one previous order in the online store. This makes it possible, for example, to have custom content in the emails and the order confirmation message concerning the customer's first order.
product:

Sets the contents printed by the tag to be processed as a product, which means that you can use product tags in the contents to be printed.

Use the ID number of the selected product as the attribute's value.

E.g. product: 2

category:

Sets the contents printed by the tag to be processed as a product category, which means that you can use product category tags in the contents to be printed.

Use the ID number of the selected product category as the attribute's value.

E.g. category: 2

brand:

Sets the contents printed by the tag to be processed as a brand, which means that you can use brand tags in the contents to be printed.

Use the ID number of the selected brand as the attribute's value.

E.g. brand: 2

campaign:

Sets the contents printed by the tag to be processed as a campaign, which means that you can use campaign tags in the contents to be printed.

Use the ID number of the selected campaign as the attribute's value.

E.g. campaign: 2

infopage:

Sets the contents printed by the tag to be processed as a content page, which means that you can use content page tags in the contents to be printed.

Use the ID number of the selected page as the attribute's value.

E.g. infopage: 2

news:

Sets the contents printed by the tag to be processed as a news page, which means that you can use news tags in the contents to be printed.

Use the ID number of the selected news item as the attribute's value.

E.g. news: 2

after/before:

By using the after and before attributes you can define content that is output either after or before the tag's output.

Allowed values:The HTML and Interface markup

E.g.

  • before: '<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'
  • after: '<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'

If the tag does not produce any content, neither the content of the after and before attributes will be output.

escape:

Adds an escape character before quotation marks in the output.

The attribute makes it easier to process the tag-produced content when using JavaScript.

Allowed values:true/false. The default value is false.

or:

Defines alternative content that is displayed if the tag itself does not produce any content.

Allowed values:The HTML and Interface markup

E.g. or:'Sisältöä ei löytynyt.'