Prints the details for a single product category.

Kuvaus

By default, the tag does not print anything. The entire output has to be defined by using product category tags in the helper attribute.

You can define the product category that should be processed by giving the relevant value to the id attribute.

Syntaksi

{Category(
    id: int / string,
    helper: string
)}

Näkyvyys

Toimii näkyvyydessä: globaali

Näkyvyyshelper-attribuutissa: tuoteryhmä

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

Printing product category details by using the {Category} tag

You can print highly flexible representations of single product categories by using the {Category} tag. The examples below show a few ways to use the tag:

{Category(
    id: 5,
    helper: {{ 
        <a href="{CategoryURL}">
            <header class="banner">
                <img src="{CategoryImageURL}"/>
                <h2>{CategoryName}</h2>
                {CategoryDescription}
            </header>
        </a>
    }}
)}

The above markup prints the details of a single product category in a <header> element, which can be used as a fixed banner on one of the online store's pages, for instance.

All banner parts are printed in the helper attribute by using product category tags.

{Category(
    id: 7,
    helper: 'helpers/category-products'
)}

In this example, the {Category} tag has been used to print the products of a single product category. The markup for the product list itself has been saved in the theme's file helpers/category-products.html:

{CategoryProducts(
    helper: {{
        <div>
            <h3>{ProductName}</h3>
            {ProductListImage}
            {ProductPrice}
            {ProductAddToCart}
        </div>
    }}
)}

The product list is printed by using the {CategoryProducts} tag, whose helper attribute uses product tags.

You can use the {Category} tag in areas such as the product category page (in the product list and display window) to print the upper category's details.

{Category(
    id: 'PARENT',
    helper: {{
        {CategoryName}
        {CategoryDescription}
    }}
)}

Note that the tag has to be used in the product category scope, in which it is possible to set the attribute id:'PARENT'. So you can use the tag in this way for areas such as on product category pages or inside the {Category} tag itself.

Attribuutit

id:

The ID number for the product category to be printed or the following values:

  • 'HOMEPAGE': the front page is set as the product category (i.e. the root product category)
  • 'PARENT': the upper category of the current product category is set as the product category (this works only in the product category scope)
helper:

Defines the content and markup format of a printout.

Allowed values: the Interface and HTML markup that define the output's markup and content.

The helper attribute can be used in two ways:

  • you can indicate the desired markup directly as the attribute's value, or
  • you can indicate a reference to a file with the desired markup as the attribute's value.

    The reference should be indicated in relation to the theme's root directory.

See also detailed instructions on using the helper attribute.

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: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:HTML and Interface markup.

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