customer_account:template_manager:template_manager_variables:filter_variables
Template manager - filter variables
All template files contain the generation of the category filter, vendor filter, price filter and other attribute filter e.g. color,size,.. filter.
The filter area consists of three parts:
- Currently selected filters that are to be removed.
- Available filters.
- Irrelevant filters that contain the entire query output.
Variables
Variable | Type | Brief description |
---|---|---|
CHOSEN_FILTERS | array | An array of filters that are currently selected |
CATEGORY_CHOSEN_FILTERS | array | An array of category filters that are currently selected |
COMPANY_CHOSEN_FILTERS | array | Array of vendor filters that are currently selected |
PRICE_CHOSEN_FILTERS | array | Array of price filters that are currently selected |
FILTERS | array | Array of all selectable filters |
REDUNDANT_FILTERS | array | Array of irrelevant filters |
REMOVE_ALL_FILTERS | string | URL to the search results with all previous filters removed. |
Items of all CHOSEN_FILTERS arrays
Variable | Type | Brief description |
---|---|---|
ITEM.name | string | Name of the selected filter, e.g. Color |
ITEM.display | string | The character string of the selected filter to be displayed |
ITEM.link | string | URL to the search results with this filter removed |
ITEM.value | string | Value of the selected filter, z.B.: red |
Expanding items of range filters (for example, the price filter)
Variable | Type | Brief description |
---|---|---|
ITEM.params.min | string | Minimum of the range filter |
ITEM.params.max | string | Maximum of the range filter |
You can access the structure of the selectable filters, for example, in the following way:
Variable | Type | Brief description |
---|---|---|
FILTERS.cat.filters | array | Array of the selectable category filters |
FILTERS.vendor.filters | array | Array of the selectable vendor filters |
FILTERS.price.filters | array | Array of the selectable price filters |
Items of the array of the selectable filters
Variable | Type | Brief description |
---|---|---|
ITEM.name | string | Name of the filter, e.g. category |
ITEM.depth | string | Depth within a filter hierarchy |
ITEM.frequency | integer | absolute frequency of items with this filter in the search result |
ITEM.weight | number | relative weight of this filter, for the tag cloud display for example |
ITEM.link | string | URL query string to the search results, additionally selected with this filter |
ITEM.params[0] | string | Value of the filter (e.g. “red”) |
Code examples
Here is a small code example that checks if there are chosen filters and prints them out in the search result.
{if $CHOSEN_FILTERS} <div class="fl-chosen-filters-bar"> {include file='components/chosen_filters.tpl'}{*This file generates the chosen filters HTML structure*} </div> {/if}
If you want to check if a certain filter is selected (e.g. color=red), you can use this:
{if $CHOSEN_FILTERS.color[0].value == 'red'} {*Do something*} {/if}
Please refer to our documentation about the {generated_filters}
→
template manager plugins
This example creates the HTML structure for the filters category, vendor and price:
<!-- Warning: Outdated. Don't use it! --> <div id="flMainFilters"> <div class="flFilterBox"> <strong style="font-size:12px;">Category</strong> <div class="flFilterBoxFilters">{filter name="cat"}</div> </div> <div class="flFilterBox"> <strong style="font-size:12px;">Manufacturer</strong> <div class="flFilterBoxFilters">{filter name="vendor"}</div> </div> <div class="flFilterBox"> <strong style="font-size:12px;">Price</strong> <div class="flFilterBoxFilters">{filter name="price"}</div> </div> </div>