Filters error when using direct URL
-
Hello Nick,
I’ve discovered another issue.
When filtering, it adds parameters in the URL, which is great but if I share that URL and use it directly (or simply refresh my page with the parameters in the url), price filters is not working properly. For example my Price filter should return 90-120 (which is the case when I filter myself and click on OK), but when I use the generated URL to go to the same listing with selected filters, it returns 14-265 (which is the default price selection when no filter is selected). Only workaround is to submit the filter after the page is loaded without touching anything and then the Price selection is ok. Can, you do something about it ?
NB : Apply Parameters From The Address Bar To Display Filter Items? is checked
Other filters (categories, attribute, work fine).
Kinda same weird stuff is happening when displaying all products in one page.
I’m using pre_get_posts filter to add a possibility to display all the products instead of a pagination.function SearchFilter($query) { if ($query->is_search && !is_admin()) { if (isset( $_GET['showall'] ) && $_GET['showall'] == 1 ) { $query->set( 'paged', 1 ); $query->set( 'posts_per_page', - 1 ); } else { $query->set( 'posts_per_page', 12 ); } } return $query; } add_filter('pre_get_posts','SearchFilter');
It works great but the price filter goes nuts (display from 1000000000 to 1000000000 €) and other filters don’t work properly either. Should I add something in my function to let the plugin know I’m displaying all the product instead of a pagination ?
Thanks a lot.
- The topic ‘Filters error when using direct URL’ is closed to new replies.