From 2656ad936fef34df39b50f4973f5eb4607d11107 Mon Sep 17 00:00:00 2001 From: Kamlesh Pathekar Date: Tue, 31 Jan 2023 12:20:38 +0000 Subject: [PATCH] [FIX] website_sale: fix the disappearing attribute filter Steps: - In eCommerce activate Filter by prices and Attributes & variants filters - select one attribute with >1 item (e.g. aluminum legs) - put a price limit. - the attribute filter is removed. The commit will prevent the removal of the 'variants attribute filter' when an attempt is made to apply a price range. task-3101343 closes odoo/odoo#120692 X-original-commit: a295faafd059b9aa38b759f7ce4ef7f3108464c4 Signed-off-by: Victor Feyens (vfe) --- .../static/src/js/website_sale_price_range_option.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/website_sale/static/src/js/website_sale_price_range_option.js b/addons/website_sale/static/src/js/website_sale_price_range_option.js index c36ea3663e4..cbea63c7b08 100644 --- a/addons/website_sale/static/src/js/website_sale_price_range_option.js +++ b/addons/website_sale/static/src/js/website_sale_price_range_option.js @@ -18,19 +18,19 @@ publicWidget.registry.multirangePriceSelector = publicWidget.Widget.extend({ */ _onPriceRangeSelected(ev) { const range = ev.currentTarget; - const search = $.deparam(window.location.search.substring(1)); - delete search.min_price; - delete search.max_price; + const searchParams = new URLSearchParams(window.location.search); + searchParams.delete("min_price"); + searchParams.delete("max_price"); if (parseFloat(range.min) !== range.valueLow) { - search['min_price'] = range.valueLow; + searchParams.set("min_price", range.valueLow); } if (parseFloat(range.max) !== range.valueHigh) { - search['max_price'] = range.valueHigh; + searchParams.set("max_price", range.valueHigh); } let product_list_div = this.el.querySelector('.o_wsale_products_grid_table_wrapper'); if (product_list_div) { product_list_div.classList.add('opacity-50'); } - window.location.search = $.param(search); + window.location.search = searchParams.toString(); }, });