
- MODX 3
- PHP 8.2
- miniShop3
- Vue 3


The package adds filter type ms3oc. Shoppers see color squares from the dictionary, not a plain value list. The package does not change the built-in mFilter type colors.
You need mFilter installed. Without it, OnMFilterInit never runs and type ms3oc will not appear.
{
"color": {
"type": "ms3oc",
"source": "option",
"field": "color",
"label": "Цвет",
"tpl": "tplMFilterMs3OptionsColor",
"multiple": true
}
}| Field | Purpose |
|---|---|
type | Always ms3oc for dictionary swatches |
source | Usually option |
field | Option values and dictionary option_key. If field is empty, the Filter Set key is used |
| object key | Must match mFilterForm filters. Does not drive the dictionary when field is set |
label | Block label on the storefront |
tpl | Row chunk: stock tplMFilterMs3OptionsColor or your own |
multiple | Several values at once |
Dictionary option_key is field, otherwise the Filter Set key. Example: key color_swatch with "field": "color" looks up swatches by color (#1).
Run the results snippet (mFilter / baseIds) first, then the form:
{'!mFilterForm' | snippet : [
'filters' => 'color',
'tplItem' => 'tplMFilterMs3OptionsColor'
]}[[!mFilterForm?
&filters=`color`
&tplItem=`tplMFilterMs3OptionsColor`
]]mFilter / mFilterForm parameters depend on your build. See mFilter snippets. ms3OptionsColor needs:
"type": "ms3oc"filters matching the JSON keymFilterForm passing hex / pattern / ral on each item (or flat $hex, $pattern, $ral)&tplItem=tplMFilterMs3OptionsColor when your mFilter build needs it.
tplMFilterMs3OptionsColor Two data shapes for the chunk:
| Source | Fields |
|---|---|
| demo / manual call | $item.value, $item.label, $item.hex, $item.pattern, $item.ral, $item.count, $item.selected |
| mFilterForm | flat $value, $label, $hex, $pattern, $ral, $count, $active |
Minimal custom row (Fenom). Attributes data-ms3oc-filter-label and data-ms3oc-filter-count are hooks for package CSS (label and count).
<label data-ms3oc-filter{if $active?} data-selected{/if}>
<input type="checkbox" name="{$key}[]" value="{$value | escape}" {if $active?}checked{/if}>
<span data-ms3oc-swatch data-size="sm"
{if !$hex && !$pattern}data-empty{/if}
style="{if $hex}background-color:{$hex};{/if}{if $pattern}background-image:url('{$pattern}');{/if}"></span>
<span data-ms3oc-filter-label>{$label ?: $value}</span>
<span data-ms3oc-filter-count>{$count}</span>
</label>Storefront CSS (ms3optionscolor_frontend_css) must be on. Otherwise the filter swatch often has no size.
| Symptom | Check |
|---|---|
| Text only, no swatches | Filter Set uses colors instead of ms3oc |
Type ms3oc missing | mFilter installed, cache cleared, plugin on OnMFilterInit |
| Value missing from the filter | Dictionary row has no HEX and no pattern. ms3oc skips it |
| Empty squares | CSS not loaded (frontend_css) or your chunk outputs an empty hex |
| No styles | ms3optionscolor_frontend_css or a manual <link> to css/web/main.css |