Prints a product list whose contents and markup can be modified almost completely freely.

Kuvaus

By default, the following information is printed about every product:

When the {Products} tag is used on the page of a product category, brand or campaign, the tag prints by default all belonging products.

Most product lists are aliases of the {Products} tag. So, you can print the contents of most lists by using this tag.

When the <ProductListFilters supported = "true" /> option is enabled in the theme's settings, the {Products} tag will function in a slightly different way.

Syntaksi

{Products(
    category: int,
        subcategories: boolean,
    brand: int,
    campaign: int,
    id: int,
    keyword: string,
    filters: string,
    timelimit: string,
    similar_to: int,
    compatible_to: int,
    add_on_to: int,
    spare_part_to: int,
    crosssales_for: int,
        fallback: boolean,
    limit: int,
    prelimit: int,
    sort: string,
    pagination: boolean,
    type: string,
        list_type: string,
        list_classes: string,
    classes: string,
    helper: string
)}

Näkyvyys

Toimii näkyvyydessä: globaali

Näkyvyyshelper-attribuutissa: tuote

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

Printing promoted products from hidden product categories

You can print promoted products from hidden product categories by using the {Products} tag. It's especially handy if the products you'd like to present in your store belong to different product categories or brands.

  1. Create a new product category and hide it by unselecting all versions in the product category form's Show in version item.
  2. Add the promoted products to the hidden product category and note down its ID, which is visible in the browser address bar.
  3. Place the {Products} tag at the desired location in your theme, and give it the ID in the category attribute.

    You can also define the list's content by using other criteria. The example below shows how to include on a list only the products that are in stock.

    {Products(
        category: 2,
        filters: 'discounted|in_stock'
    )}

You can also use the featured products to implement promoted products.

Attribuutit

When product filters are enabled in an online store, a number of attributes used for managing the list contents cannot be applied to the {Products} tag anymore.

When product filters are enabled, only the following formatting attributes can be applied to the {Products} tag:

  • type
  • list_type
  • list_classes
  • classes
  • helper

The {Products} tag's aliases (e.g. {CategoryProducts}, {DiscountProducts} etc.) work as usual. These tags cannot be used with product filters.

Learn more about the impact of product filters on product lists.

category:

Defines the product categories from which products should be retrieved.

Allowed values: product category ID numbers separated by pipes. To retrieve products from all product categories, use the value 'ALL'.

E.g. category:'2|34|5'

subcategories:

Defines whether products should be retrieved also from subcategories of the product categories defined in the category attribute.

The attribute is used only if a value has been assigned to the category attribute.

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

brand:

Defines the brands whose products should be retrieved.

Allowed values: brand ID numbers separated by pipes. To retrieve products from all brands, use the value 'ALL'.

E.g. brand:'2|34|5'

campaign:

Defines the campaigns whose products should be retrieved.

Allowed values: campaign ID numbers separated by pipe characters. To retrieve products from all campaigns, use the value 'ALL'.

E.g. campaign:'2|34|5'

id:

Defines the products that should be included on the list based on their ID numbers.

Allowed values: pipe-separated product ID numbers

keyword:

Search terms that define which products should be displayed on the list.

To learn more about how the search works, see our user guide.

Allowed values: space-separated search terms.

E.g. keyword:'paidat housut Jamppa'

filters:

Sets ready filters to the list to be printed for selecting products that should be included on that list.

Allowed values:

  • 'discounted': discounted products (i.e. products that belong to any active discount campaign)
  • 'regularly_priced': regularly priced products
  • 'featured': featured products

    Products can be marked as featured in the product form's item Visibility settings > Featured product.

  • 'has_images': only products with product images
  • 'preorder': products that can be preordered (their limited availability period hasn't started yet)
  • 'released': all products that cannot be preordered and have been released within the last year

    You can set the filter to retrieve products from a specific timespan by using the timelimit attribute.

  • 'in_stock': products that are in stock
  • 'out_of_stock': products that are out of stock
  • 'available': products that are available
  • 'unavailable': products that are out of stock and are no longer being sold
  • 'navigable': the product is navigable

    This means that the product belongs to a product category and no level in its category hierarchy has been excluded from the active store version.

  • 'not_in_cart': products that aren't in the shopping cart

If you want to use multiple filters, separate the values with pipe characters.

E.g. filters:'discounted|released'

timelimit:

Sets the time span from which products are retrieved on the list.

Allowed values:

  • Days: '-n days'
  • Weeks: '-n weeks'
  • Months: '-n months'

E.g. timelimit:'-3 months'

You can switch off the time limit altogether by setting the value to 0.

similar_to:

Defines the products for which products marked as similar should be printed on a list.

Sallitut arvot: pipe-separated product ID numbers or any of the default filters:
  • 'cart': selects cross-sell products based on the products in the shopping cart
  • 'last_viewed': selects cross-sell products based on the products recently viewed by the customer
  • 'last_bought': selects cross-sell products based on the products recently purchased by the customer (the customer must be logged in)

If ready filters do not produce any results, the attribute will try to retrieve cross-sell products based on the products belonging to the scope. To prevent it from happening, use the fallback:false attribute.

E.g. similar_to: '1|14|24' or similar_to: 'cart'

compatible_to:

Defines the products for which compatible products should be retrieved and displayed on a list.

Sallitut arvot: pipe-separated product ID numbers or any of the default filters:
  • 'cart': selects cross-sell products based on the products in the shopping cart
  • 'last_viewed': selects cross-sell products based on the products recently viewed by the customer
  • 'last_bought': selects cross-sell products based on the products recently purchased by the customer (the customer must be logged in)

If ready filters do not produce any results, the attribute will try to retrieve cross-sell products based on the products belonging to the scope. To prevent it from happening, use the fallback:false attribute.

E.g. compatible_to: '1|34|2' or compatible_to: 'cart'

add_on_to:

Defines the products for which accessories should be retrieved and displayed on the list.

Sallitut arvot: pipe-separated product ID numbers or any of the default filters:
  • 'cart': selects cross-sell products based on the products in the shopping cart
  • 'last_viewed': selects cross-sell products based on the products recently viewed by the customer
  • 'last_bought': selects cross-sell products based on the products recently purchased by the customer (the customer must be logged in)

If ready filters do not produce any results, the attribute will try to retrieve cross-sell products based on the products belonging to the scope. To prevent it from happening, use the fallback:false attribute.

E.g. add_on_to: '1|34|2' or add_on_to: 'cart'

spare_part_to:

Defines the products for which spare parts should be retrieved and displayed on the list.

Sallitut arvot: pipe-separated product ID numbers or any of the default filters:
  • 'cart': selects cross-sell products based on the products in the shopping cart
  • 'last_viewed': selects cross-sell products based on the products recently viewed by the customer
  • 'last_bought': selects cross-sell products based on the products recently purchased by the customer (the customer must be logged in)

If ready filters do not produce any results, the attribute will try to retrieve cross-sell products based on the products belonging to the scope. To prevent it from happening, use the fallback:false attribute.

E.g. spare_part_to: '1|34|2' or spare_part_to: 'cart'

crosssales_for:

Defines the products for which products that were sold together should be retrieved and displayed on the list.

Sallitut arvot: pipe-separated product ID numbers or any of the default filters:
  • 'cart': selects cross-sell products based on the products in the shopping cart
  • 'last_viewed': selects cross-sell products based on the products recently viewed by the customer
  • 'last_bought': selects cross-sell products based on the products recently purchased by the customer (the customer must be logged in)

If ready filters do not produce any results, the attribute will try to retrieve cross-sell products based on the products belonging to the scope. To prevent it from happening, use the fallback:false attribute.

E.g. crosssales_for: '1|2|3' or crosssales_for: 'last_viewed'

fallback:

Prevents the cross-sell attributes' default values from being used.

See also detailed instructions on using cross-sell attributes.

The attribute is enabled only if the similar_to, compatible_to or crosssales_for attribute has a value assigned.

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

limit:

Sets the maximum length limit to the list to be printed.

The limiting settings for the pagination tools are determined based on the values of the limit attribute as well.

Allowed values: list of integers separated by pipe characters.

The first value on the list is used as default in the limit menu printed by the {PaginationLimit} tag.

E.g. limit:'1|5|10'

prelimit:

Limits the length of the list to be printed. The list's pagination and sorting are defined in the sort attribute.

This attribute is mainly used to pick, for example, 10 most relevant products from cross-sell and search result lists, and randomly display a limited number of them.

Allowed values:integers

sort :

Defines how a list should be sorted. The attributes values define also which values should appear on the pagination menu.

Allowed values:

  • 'search': the order manually defined in the admin panel
  • 'last_sold': recently sold products first
  • 'name_asc': in alphabetical order based on names (A-Z)
  • 'name_desc': in reverse alphabetical order based on names (Z-A)
  • 'price_asc': lowest price first
  • 'price_desc': highest price first
  • 'released_asc': date added (oldest first)
  • 'released_desc': date added (newest first)
  • 'random': random order
  • 'sales_asc': least sold first
  • 'sales_desc': bestsellers first

If you'd like to use multiple sorting criteria, separate the values with pipes.

E.g. sort:'name_asc|name_desc|released_asc'

pagination:

Defines whether pagination tools should be displayed.

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

type:

Defines the markup type of the list to be printed.

Allowed values:

  • 'normal': Every list element is a separate div element. The list doesn't have nested elements.
  • 'list': The list is printed as an HTML list. To define the type of the list, use the list_type attribute.
  • 'ids': The list doesn't contain any markup, and the tag returns only products' ID numbers as strings separated by pipes.
list_type:

Defines the markup type of a product list.

The attribute is enabled only if the type attribute's value is 'list'.

Allowed values:'ul' or 'ol'.

list_classes:

Class names given to any list element that contains a list (<ul> or <ol>, depending on the value of the list_type attribute).

The attribute is enabled only if the type attribute's value is 'list'.

Allowed values:space-separated class names as strings.

E.g. list_classes:'ekaLuokka tokaLuokka'

classes:

Class names that are given to every list element.

Allowed values: class names as strings.

Use space characters to separate the classes that are to be given to the same element. Use pipes to separate the classes that are to be given to different list elements.

E.g. classes:'ekaLuokka tokaLuokka | jokaToisenLuokka jokaToisenTokaLuokka'

See also detailed instructions on how to define list class names.

helper:

Defines the content and output format of a single list element.

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: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.'