[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) <vfe@odoo.com>
This commit is contained in:
Kamlesh Pathekar
2023-05-08 17:10:53 +02:00
parent c5d583ca35
commit 2656ad936f
@@ -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();
},
});