For build multidimensional filtering with MixitUp3 library you will have to purchase a MixitUp MultiFilter extension at the official site. It is not publicly available via GitHub or NPM and can only be downloaded from your account after purchase.
MixitUp MultiFilter extends the MixitUp ability to query and index groups of filter controls, known as "filter groups" and can be used with different types of controls.
Select and Radiobuttons controls allow one active control at a time. It means that user will be able to select only one option in each category. For example: show only Shirts, only for Men and only Blue color.
Checkboxes allow multiple active controls simultaneously. It means that you can setup filter to be able select several options in one category. For example: show Shirts and Hoody, for Men, available in Blue and Black colors.
Structure of the Mixer container stays the same. Required structure of the Dynamic Item and process of applying classes were described in the Filtering CMS Content tutorial.
While process of creating controls stays the same and described in a previous tutorials, layout for the controls needs additional attention.
Each group of filters (type of filter-dimension) needs to be wrapped into a div with a specific attribute data-filter-group that will be applied later.
In my example I have a collection of clothes that has 4 categories applied:
So inside the .controls-form I created 4 divs with class .filter-group and put my controls (elements with class .select_filter) in those divs.
Custom attributes data-filter-group will be applied later by additional code snippet.
One more option we need for our filter is a button for reset all filters. For this purposes we will use Embed Code component which we will give class .filter-group as well. Inside this component add an HTML code for the button:
Custom code structure:
This process will require adding 3 new code snippet into already known structure described on the page Using Select element for controls:
Important: In my MultiFilter example I didn't use sorting, but if you have, for the Sorting functionality you don't need to change anything.
That's it! Your filter should be ready.
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
Radiobuttons controls will be structured the same way we did for the Select elements:
Add values to each radiobutton accordingly to classes that has been created from filtering categories, applied to mix-items. Value should contain a classname in CSS format.
Important!: Make sure to keep Group Name same for each filter-group's radiobutton.
Custom code structure:
Similar to previous example, we will add 3 code snippets into already known structure described on the page Using Radiobuttons for controls:
Important: In my MultiFilter example I didn't use sorting, but if you have, for the Sorting functionality you don't need to change anything.
That's it! Your filter should be ready.
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
And again, Checkbox controls layout will be structured the same way we did it for the Select elementsand Radiobuttons :
For enabling multiple active selections in one category we will apply a custom attribute data-logic to the .filter-group div and make it equal "or". This way we are changing filtering logic inside one category while logic between categories remains "and".
This attribute can be applied to any numbers of "filter-groups", depends on your filter requirements.
Custom code struture:
On the final step we will add some code snippets for activate MultiFilter (similar to previous examples) and also simplify already known code structure described on the page Using Checkboxes for controls (since we are not using "All" option and don't need the code for that)
That's it! Your filter should be ready.
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉