Product attribute lists permalinks ("/attribute/term") were not working
for attribute names containing non-ascii characters. That's because
when the attribute taxonomy was registered the url rewrite rules were
created using the sanitized version of the attribute name, which
implies converting these characters into the urlencoded version.
The fix consists of applying "urldecode" to the sanitized attribute
name before using it to create the rewrite rule. The sanitization
needs to be kept for compatibility purposes, since it also replaces
latin characters with accents into the non-accent versions
(this conversion won't be affected by "urldecode")
get_related_products_query in the WC_Product_Data_Store_CPT class is
querying the suitable products with a "limit" clause, this causes
that products down in the table are never picked for display.
This commit adds a ORDER BY RAND() to the query so that all products
have a chance to get picked.
This method is now redundant since the `$object_type` property is set for the class. This means the parent method will now return the exact same value.
PR 29896 added extra handling in response to the 'post_clauses' hook
in order to use the new product attributes lookup table. However it
also added a new 'where' clause based on the value returned by
'get_main_search_query_sql', which turns out is not needed and
causes problems with some themes.
This commit removes that extra 'where'.
The "seach block" product doesn't display the textbox because its
HTML is filtered out by `wp_kses_post`. This fix hooks on
'wp_kses_allowed_html' in order to explicitly allow the HTML elements
of the block in the shop page.
Instead, a product selector has been added to the "Regenerate
product attributes lookup table" entry in the tools page. If a product
is selected, the tool regenerates the data only for that product;
otherwise, it regenerates the entire table.
This has forced a change on how the tools page is rendered. Now,
instead of each tool being just a description and a trigger link,
a form with GET method is rendered for each tool. The forms are rendered
first and then the tools, since HTML doesn't allow to include forms
inside tables; each button is associated to its form with a "form"
attribute.
Additionally, now the tools array returned by the woocommerce_debug_tools`
hook can have a 'selector' array with the details needed to render a
selector, which will also be part of the form for the tool.