[FIX] website_sale: add noFuzzy when it's active

`website_sale` module has custom handler for form submit event. That handler
ignores `noFuzzy` attribute. As result, adding `data-no-fuzzy="1"` to
`input[name=search]` works everywhere, but not on shop product list pages.

STEPS:

1. Settings > Technical > Views > website_search_box_input & website_search_box > Code in data-no-fuzzy="1" into the <input> tag
2. Go to Website >.Shop > Customize > Enable ecommerce categories
3. Search for a product on the main shopping page and enter > Observe the URL > There is no noFuzzy param
4. Go to any product's page on the website > search for a product through the search bar and enter > Observe the URL > there is a noFuzzy param passed

opw-3051319

closes odoo/odoo#107771

X-original-commit: 1df3b14f86bada2e2cf278d2b4e591996e9e8db8
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
Ivan Yelizariev
2022-12-13 10:05:12 +01:00
parent fd62ef58b8
commit a73cb1ca95
@@ -780,6 +780,9 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, car
ev.preventDefault();
var oldurl = $this.attr('action');
oldurl += (oldurl.indexOf("?")===-1) ? "?" : "";
if ($this.find('[name=noFuzzy]').val() === "true") {
oldurl += '&noFuzzy=true';
}
var search = $this.find('input.search-query');
window.location = oldurl + '&' + search.attr('name') + '=' + encodeURIComponent(search.val());
}