
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 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 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.
mFilter 1.9.1
A patch to 1.9.0: the order of products on a page and sorting in search, the mfilter.default_limit setting, which had no effect, and the offset parameter.
Bugfixes
- Products from an extra category came out on the page in id order. A catalogue with
&element=msProductsandsortby=menuindex: products added to a section as an extra MiniShop3 category were listed by ascending id rather than in the order set in the manager. The set of products on a page was right; the order within it was not. The page now comes out in the order mFilter got during the selection, without sorting it again. - On a search page, picking a sort only changed the order within a page. mSearch results were split into pages by relevance, and the chosen sort re-sorted each page on its own: with "most expensive first", some expensive products landed on page two. A chosen sort now orders the whole search result; without one, relevance applies.
- The
mfilter.default_limitsetting had no effect. The page size came from the snippet propertylimit = 20: an admin set 24 and got 20. The property now ships empty: empty — the setting applies, filled in — it overrides the setting,&limitin the call above both. An empty setting gives 20 rather than the whole catalogue on one page. - The
offsetparameter behaved differently in each mode. With&elementit cut the start off every page; without&elementit was lost after the first AJAX request. In both modesoffsetnow skips the first N products of the results. As in pdoPage, the found count covers all products, the page count those left afteroffset.
Upgrade notice
Pages from the MODX cache and offset
A page cached before the upgrade keeps the old settings of its call: with &element the first render from the cache shows a short page, without &element AJAX starts the list from the top. If the call has an offset, clear the site cache after the upgrade.
The limit property of the mFilter snippet
Snippet properties are overwritten on package upgrade, as before. If the limit property held a number of your own, it is empty after the upgrade, and the page size comes from mfilter.default_limit. Set your value in the setting or as &limit in the call.
A custom snippet in place of msProducts or pdoResources
For the page output, mFilter passes the element the page's ids in resources and an empty sortby. A custom element that sorts on its own has to keep the order of resources in that case.
