What BitFacet is

BitFacet is a catalog filter for MODX 3: checkboxes, from/to ranges, sorting, search and paging, with a product count next to every value. Data comes from resources, TVs, MiniShop3 (product fields, options, vendors, extra categories, variants) and your own tables.

The filter does not query the database on every request. The component builds an index in advance — bitmaps "value → products" — and keeps it in opcache. A request with any number of checked filters is computed from the index in a few milliseconds even on hundreds of thousands of products. When products change, the index updates itself.

Terms. A filter set describes a filter: which products, which filters, sorting, search (a JSON file, Filter sets tab). The index is the data built from a set. A facet is a list filter (brand, color), a range is a from/to filter (price, weight, date).

Requirements

Up and running in 5 minutes

  1. Install the package. The installer creates the example filter set: with MiniShop3 — products, vendor, color, size, tags, "In stock", price, weight; without MiniShop3 — all resources of the web context, section and template. The set is on the Filter sets tab.
  2. Assign the bitfacet.example template to a catalog section (resource → Template). The template already has the filter and SEO snippets, styles and the script for filtering without page reloads. For your own template see the example below.
  3. Open the section on the site. If there is no index yet, it is built on the first visit (a few seconds for tens of thousands of products). You can build it in advance: Overview → Rebuild.
  4. Adjust the set to your shop on the Filter sets tab (pencil next to the set): which products, which filters and in what order, sorting, search. After saving, the index is rebuilt automatically.
  5. Set up cron (Index tab → ready-made line). Every few minutes it checks whether the index needs a rebuild, and once a day rebuilds it completely. The filter also works without cron: the index is updated on site events.

The filter in your own template

Three lines are enough: the SEO snippet at the top of <head>, the filter in the page body and the script before </body>.


    [[!BitFacetSeo? &set=`auto`]]
    [[!+bitfacet.title:default=`[[*pagetitle]]`]]
    ...


    

[[!+bitfacet.h1:default=`[[*longtitle:default=`[[*pagetitle]]`]]`]]

[[!+bitfacet.text]] [[!BitFacet? &set=`auto` &limit=`24`]]

Checking