Here you can learn how to create product filters for product lists in MyCashflow themes.

Adding product filter support to a theme

  1. In the admin panel, go to Products > Product features.
  2. Define the necessary filters, their values and product features.

    Learn more about managing filters and assigning product features to products.

    Product filters won't be enabled in an online store if at least one of them is not visible.

  3. Add the <ProductListFilters supported="true"/> setting to the theme.xml file.

    The example below illustrates theme settings with support for product filters.

        <ProductListFilters supported="true"/>
        <BrandProductListFilters supported="true"/>
        <CampaignProductListFilters supported="true"/> 

    If you'd like to use product filters on brand and campaign pages as well, you must also add the following settings:

    • <BrandProductListFilters supported="true"/>
    • <CampaignProductListFilters supported="true"/>

    Lue tarvittaessa lisää teeman asetuksista.

    Enabling the product filter setting changes the functioning of the {Products} tag. See the next section to learn more.

  4. Add the {ProductListFilters} tag to the theme before product lists.

    The tag is enabled for all pages, but you may want to use it especially in connection with main product lists on product category, brand and campaign pages.

    See also a list of product filter tags and a sample product filter implementation in Barebones.

    Within the same page, the {ProductListFilters} tags can be applied to only one product list.

    Product filters can be added only to product lists that have been created by using the {Products} tag.

    When you implement filters, you can also use filters from the search result page (if they have been implemented in the online store's theme).

    The tags on the search result page work in the same way. Simply change the tags' names to save time and effort during the implementation.

  5. Format filters according to your preferences.

    You can use Barebones' filters.js plugin and ready SCSS styles to format filters.

How product filters impact product lists

When product filters are enabled in the online store and supported in the store theme, a number of attributes normally used for defining list contents become disabled for the {Products} tag.

The contents of the lists that use product filters can be managed in the store settings.

The following attributes can still be used with the {Products} tag even when product filters are enabled in the store:

  • 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.

Displaying product features on product pages

MyCashflow's in-built default theme Barebones includes in-built support for the feature.

You can set product features' values to be displayed on product pages by using the product filter Display as product feature on product pages setting.

In the product template, add the following markup to the location where you'd like to display product features:

  helper: {{
      before: {{ <p class="ProductAttribute-{ProductAttributeId}"> }},
      after: {{ </p> }}

See the individual parts of the example explained below:

  • The {ProductFeatures} tag creates a list that contains the product's features. The helper attribute defines how each feature should be displayed.
  • By default, {ProductAttributeValues} prints feature values as a comma-separated list.

    You can define the separator yourself by using the separator attribute or define the entire markup for each value by using the helper attribute.

  • For each feature, the {ProductAttributeId} tag adds a feature identifier, which is defined in the admin panel. This information can be used, for example, for writing CSS styles or scripts.

Product filters in the Barebones theme

Below you can see the default implementation of product filters on the product list page in the Barebones theme:

<!-- Valittavissa olevat suodattimet pudotusvalikkoina -->
	before: '<div class="ProductListFilters">',
	after: '</div>',
	helper: '{{
			before: '
				<div class="FilterGroup">
					<a class="FilterGroupName" href="#FilterList-{FilterClass}" tabindex="0">{FilterName}</a>
					<div id="FilterList-{FilterClass}" class="FilterList" tabindex="-1">',
			after: '

<!-- Valitut suodattimet ja niiden poistolinkit -->
	before: '
		<label>{%ProductFiltersSelected}: </label>
		<ul class="FilterTags">',
	after: '
			<li class="ClearAllFilters"><a href="{ProductListFiltersClearUrl}" class="RemoveFilter">{%ProductFiltersRemove}</a></li>
	helper: 'helpers/filter-tag'

<!-- Tuotelista jota suodatetaan -->
    subcategories: 'true',
    limit: '40|100',
    pagination: 'true',
    type: 'normal',
    before: '
        <div class="List ProductList">
            <div class="GridList">',
    after: '
        {Helper(file: 'helpers/pagination')}',
    helper: 'helpers/list-product',
    or: '<div class="Notification">0 {%Products}</div>'

Barebones' implementation includes two separate filter lists:

  • The first one is used to create drop-down menus with which visitors select desired filter values.
  • The other displays selected values and the option to disable individual and all values.

Additionally, Barebones includes the filter.js plugin for formatting product filter lists into drop-down menus.

Learn more about the filters.js plugin.