Outputs the whole filter: the form with value groups and ranges, sorting, search, products, pages and "Show more". Call it uncached.
[[!BitFacet?
&set=`auto`
&limit=`24`
&tplItem=`myProductCard`
]]
| Parameter | Default | What it does |
|---|---|---|
&set | example | Set name. auto — the first set whose Sections contain the page or its ancestor (a set without sections fits any page). A comma-separated list — choose among these sets. |
&parents | current page | Comma-separated sections whose products are shown. Default — the page itself if it is a catalog section; otherwise the whole set. |
&facets | all | Which filters to show and in what order: ms:vendor,ms:color. |
&ranges | all | Which ranges to show: ms:price. |
&limit | 12 | Products per page (up to 100). |
&categories | 1 | The Categories group — section tree as links. 0 — hide. |
§ionKey | section | Name of the section-tree facet in the set. |
&tplForm … &tplCategory | bitfacet.example.* | Layout chunks — table below. |
Copy an example chunk, rename it and pass it in the parameter. Placeholder values are already escaped.
| Parameter | What it is | Placeholders |
|---|---|---|
&tplForm | the whole form | groups, sorts, items, pages, more, total, q (search text), search (1 — search enabled), action, reset (URL without filters), ms (query time), endpoint, fallback, ctx |
&tplGroup | value group | key, caption, values, open (open or empty), source, field |
&tplValue | value (checkbox) | name, value, label, count, checked, disabled |
&tplRange | range | key, caption, name_from, name_to, from, to, min, max, step, type (number/date), open |
&tplOption | sorting option | value, label, selected |
&tplItem | product card | id, url, pagetitle, longtitle, introtext, uri, photo (card picture); with MiniShop3 also article, price, old_price (empty unless greater than the price), image, thumb, ms3_*; with Gallery3x — g3x_* (see "Product images" below) |
&tplPage | page link | page, url, current, class (bitfacet-page-first / -last) |
&tplMore | "Show more" | url, page, next (how many will be added), rest (how many are left) |
&tplCategory | Categories link | url, label, count, level, current, class (bitfacet-category-root / -open / -active) |
[[+name]] placeholders and [[%key]] lexicon strings is filled by simple substitution — fast, and turbo mode supports it. A chunk with output filters, snippets or Fenom goes through the parser (pdoTools if installed) — it works but is slower; in turbo mode such requests are served by the regular endpoint.Chunk myProductCard with simple placeholders:
[[+pagetitle]]
[[+price]] [[+old_price]]
SKU [[+article]]
The same chunk can be written in Fenom (pdoTools required) — for example, to show a sale badge. Such a chunk goes through the parser, so it is a bit slower:
{$pagetitle}
{$price}{if $old_price} {$old_price} Sale{/if}
The filter takes product images from the installed galleries itself — one query per page, no snippets in the card. Only the gallery table must exist on the site; nothing to configure.
| Placeholder | What it is |
|---|---|
photo | Card picture from whatever exists: MiniShop3 gallery (small size, otherwise thumb), otherwise the first Gallery3x image (medium), otherwise the MiniShop3 placeholder (ms3_product_thumbnail_default). Empty for plain resources without galleries. |
image, thumb | Main MiniShop3 product image and its thumbnail — product fields. A product without an image gets the MiniShop3 placeholder in thumb. |
ms3_thumb, ms3_small, ms3_medium, ms3_large | All sizes of the main image from the MiniShop3 gallery. Names follow the size folders in the MiniShop3 media source settings (thumbnails): a custom size card gives ms3_card. |
g3x_url | Original of the resource's first active Gallery3x image. |
g3x_small, g3x_medium, g3x_big | Gallery3x thumbnails — the sizes Gallery3x creates (custom sizes — g3x_<name>). |
g3x_alt, g3x_name | Image alt (the name if alt is empty), name. |
g3x_count | How many Gallery3x images the resource has. |
A card with a picture from any gallery — photo is enough (this is how the bitfacet.example.item chunk does it):
[[+pagetitle]]
[[+price]] [[+old_price]]
MiniShop3 gallery, responsive image:
![[[+pagetitle]]]([[+ms3_small]])
A catalog of plain resources with Gallery3x (no MiniShop3) — the original opens on click (data-fancybox — if the Fancybox library is on the site):
[[+pagetitle]]
Photos: [[+g3x_count]]
Without an image the placeholder is empty. Hide an empty image with CSS: img[src=""] { display: none; }. All placeholders are simple — the card stays fast and works in turbo mode. For the whole product gallery (several images, a slider) use the galleries' own snippets on the product page (msGallery, Gallery3x).
Include one script and the filter answers without reloading the page:
.bitfacet-toggle button;What the script needs in your chunks:
| the wrapper — required | <form class="bitfacet" data-endpoint="[[+endpoint]]" data-fallback="[[+fallback]]" data-ctx="[[+ctx]]"> |
| on page links and "Reset" | data-bitfacet-link |
| on the "Show more" link | data-bitfacet-more |
| search and sorting | <input name="search">, <select name="sort"> |
| where "Show more" appends products and updates pages | .bitfacet-items, .bitfacet-pages |
While a request is running, the form has the bitfacet-loading class — handy for a loading indicator.
With friendly URLs and a catalog URL ending with "/" the filter is written into the path:
/catalog/ catalog
/catalog/brand-nike/ one filter
/catalog/color-white,blue/brand-nike/ several values — comma-separated
/catalog/price-1000-5000/ range; price-1000- and price--5000 — one side only
/catalog/instock-yes/ yes/no
/catalog/color-white/sort-price-desc/page-2/ sorting and page — last
/catalog/brand-nike/?search=jacket search — always a parameter
alias in the set; values — Latin transliteration of captions, computed when the index is built.bitfacet.seo plugin. A real resource with the same URL wins; an unknown URL is a regular 404.?f[ms:color][]=white&r[ms:price][from]=1000&sort=price:desc&page=2.The Categories group is the catalog tree as links: the current branch is expanded, the current section highlighted, each section shows its product count with the selected filters. A click opens the section page with the same filter: /catalog/clothes/color-white/.
Subsection pages need the same template (with the BitFacetSeo and BitFacet snippets) — then &set=`auto` finds the set through the ancestor.
A set may cover several contexts (resources.contexts). The filter, product links and lexicon strings follow the context of the page with the snippet.