
mFilter 1.9.0
A release about results that are no longer swapped quietly. A form without the settings of its snippet call no longer shows someone else's data, the settings of a cached page do not expire after a day, and SEO templates put in names instead of ids. Filter counts update right after a product is edited, and errors in the manager are visible.
Bugfixes
- A form without the settings of its snippet call swapped the results. AJAX finds the parameters of the
mFiltercall — element, chunks, limit, conditions — by the hash in the markup. When there was no hash, or it led nowhere, the server quietly answered with default chunks and every published resource under the page. On a catalogue with&elementthe first click mixed categories into the products. The hash is now required: without it the page sends no request and tells in the browser console what to add totplOuter. A hash the server knows nothing about gets an error 410 with an explanation. - A day after a page was rendered, filtering "reset the template". The parameters of a snippet call were kept for a day, while the page carrying their hash lives longer in the MODX cache. The next day the first click found no parameters, and the results came in default chunks with a limit of 20. Parameters that are found no longer expire but are renewed, and the catalogue no longer writes to the database on every render.
- Sorting dropped out of the address after the first filter choice. A page opened with a sort (
/catalog/sort--price-asc/) lost it in the address after the first AJAX request: the results stayed sorted, the link did not. In SEO URL mode,?sort=and?limit=are no longer lost either. - The vendors block disappeared from the form. With
sort: countorsort: value— the documentation's own recipe included — the vendors filter was gone, andpinned,custom_orderandselected_firstdid nothing for it. Vendors now sort the way values of other types do, andpinnedandcustom_orderfind them by name too. - Filter counts did not update after a product was saved. Saving or deleting a product and the scheduled index sync left the old cache, and the category showed the old counts for up to an hour. The cached values and counts of the catalogue pages whose tree holds the product are now dropped. The category a product was moved out of still waits for the cache to expire.
- A SEO template put ids in place of names. A vendor, a section, a product category and a TV holding a list of resources came out as a number in a template and an individual record: "Sofas — 3". The name is now found by the filter type, so a vendors filter keyed
brandgets a name as well. - Errors in the manager showed a lexicon key or did not show at all. A notification read a key such as
mfl_slug_not_found, and a save error in the editors went to the browser console only — the dialog just stayed open. Messages now come as text, and a save error as a notification with the reason.
New features
sort: label— sorts values by the label the visitor sees.pinnedandcustom_ordertake values and labels alike. Text compares case-insensitively for any alphabet. See Sorting filter values.{$key_raw}in a SEO template — the filter value before a name replaced it. For a vendor or a section that is the id: for a link[[~{$parent_raw}]], or a word form keyed by the id. See SEO templates.
Upgrade notice
A page without data-mfilter-hash does not filter
When the results markup has no data-mfilter-hash, the page no longer sends AJAX requests. Filters, sorting, limit, the view switcher, "show more", infinite scroll, mFilterSelected chips, reset, Back and Forward stop working. Pagination links work as plain links. The browser console shows an error with a hint.
This affects a custom tplOuter chunk without the attribute and a results wrapper moved from the chunk into a resource template. The stock mfilter.outer has the attribute. If you installed mFilter before 1.1.2 and never changed mfilter.outer — chunks are not overwritten on upgrade — open the source of a catalogue page and check that data-mfilter-hash is not empty. See Templates.
Requests without a hash from your own code — mfilter.api.apply(), the Headless API — work as before.
Names instead of ids in SEO templates
Values of vendors, sections, product categories and TVs holding a list of resources now come out as names in a SEO template and an individual record. Where a template relied on a number, fix it:
- word forms keyed by an id (value
3) are no longer found — key them by the name, or write{$key_raw.gen}; - an id inside a MODX tag, such as a link
[[~{$parent}]], turns into a name and the link breaks — write[[~{$parent_raw}]]; - an option or a TV keyed
parent,categoryorvendor_idwith numeric values now puts in the name of the resource or vendor with that number — the original value is{$parent_raw}and the like.
sort: value for vendors and sections
For types whose value is an id (vendors, Parents, Product categories), sort: value now sorts by name rather than by number. For vendors, the undocumented sort: id used to order by number; it now keeps the order by name.
