I have used search filters on one of my index view page. All the search filers are same for the second page too. I want to have a functionality in which the selected filter values from first page will be retained on the next filters too automatically and I don't have to select the filters again on the next page.
Asked
Active
Viewed 370 times
2
-
Please do share some examples and the code you have tried. To simply put you can either add the filter in your URL or localstorage – lost_in_magento Oct 12 '22 at 06:37
3 Answers
1
On the index page you could add the search filters as query params to the url using jQuery.param(). On the next page you can parse and set the params as filters.
You could also store the values with localStorage. The advantage of query params is that you can easily edit, bookmark and share the url. LocalStorage is better for storing large amounts of data. See also this SO answer.

Blee
- 419
- 5
- 11
1
You can use localStorage
in index page to store the selected value of the filters and pass it as default value of filters in next pages

saikumar305
- 39
- 7
0
sessionStorage.setItem('sample-filter' , filterValue);
you can use sessionStorage in first page . Because The value stored in sessionStorage will be deleted after the refresh.
after set sessionStorage you can use filter in next page :
sessionStorage.getItem('sample-filter');

Mahdi Najafi
- 5
- 2