Forums › Forums › Search & Filter Pro › Reset Button not resetting form
Tagged: reset button
- This topic has 7 replies, 1 voice, and was last updated 5 years, 12 months ago by Trevor.
-
Anonymous(Private) February 4, 2019 at 4:37 pm #201151
Hi S&F,
Might have found a bug with the Reset button not working when used within a form and was hoping if you could help me fix it.
So I’ve used S&F Pro to create a custom Woocommerce Product filter within a shop page. It’s setup to filter a couple of product attributes with AJAX loading and auto-count enabled and everything works like a charm actually.
However when adding the Reset button to the form it doesn’t seem to have any effect at all. Perhaps it’s some kind of bad configuration on my part, but it looks like the Reset button isn’t responding at all no matter my configuration so I was hoping you could look into this and help me fix it.
I’ll provide some more info in a private reply so you can reproduce the results for yourself.
Trevor(Private) February 4, 2019 at 4:48 pm #201152If you are using the WooCommerce method (as you are) or the Post Type archive method, and you have the
Enable filtering on Taxonomy Archives
setting, it will not work. Instead, you will need to create a fake button which is actually a link back to the page you want it to reset to. With the setup as mentioned, the form does not know where to go back to, as it could be the base shop page, or any taxonomy archives page.Trevor(Private) February 5, 2019 at 11:15 am #201189This screenshot shows the setting in your form that causes the reset link to not work:
https://www.screencast.com/t/ZUhoAglxJ386
The problem is that this setting uses rewrites to make the URL, so the form then does not know where to go back to. It is a very useful setting, so my suggestion before about not using the reset link in the form is still my recommendation, but instead place a link in a HTML widget or similar, directly below the form, that you would style to look much the same.
Anonymous(Private) February 5, 2019 at 4:00 pm #201277Hi Trevor, thanks for the help!
Yes I can see the custom link in a HTML widget working for the main shopping page (e.g. mywebsite.com/shop/) filter, but what would you suggest I do for other pages like category pages or another page where the filter’s default values are already set? (e.g. mywebsite.com/shop/?_sft_pa_country=france)
Let’s say I create my custom Reset button within my sidebar widget. It will always display the default reset link (which would be my base shopping page URL, for instance mywebsite.com/shop/) on every single product archive page. Even when a customer is on a page with only products from ‘Category A’ it will still completely reset the filter and ignore the fact that the customer is actually looking only for products within ‘Category A’.
The custom reset button should somehow be aware of the initial filter settings correct? Is there any way to achieve this kind of behavior with the SF Pro plugin?
Trevor(Private) February 5, 2019 at 4:35 pm #201289Intuitively, you would think that the reset button would work as you describe, but, at least in the current version of our plugin, it does not. You could make a small widget using PHP that codes a ‘reset’ link based on the current url less the search query string. There is a plugin called Post Snippets that allows you to make you own shortcode using PHP, and you could then place that shortcode in a text widget.
-
AuthorPosts