Forums › Forums › Search & Filter Pro › Woocommerce integration: Avoid redirection to shop page
- This topic has 4 replies, 2 voices, and was last updated 5 years, 7 months ago by Trevor.
-
Anonymous(Private) April 15, 2019 at 4:55 pm #208436
Hi,
I am trying to integrate your plugin with a Woocommerce product category page. I would like the search form to show only on the category pages and the user to not be redirected to the Woocommerce shop page (that is, the user should stay on the current page). Is this possible? How can I make a custom template to implement this?
Thanks in advance.
Trevor(Private) April 16, 2019 at 9:59 am #208464There are three conditions to stop the page re-directing.
Your Product Category (still) needs to be a field in the form (if you do not want the use to be able to use this, use custom CSS to hide it), and you can then set the form to AutoDetect. These screenshots are for the Post Type Archive method, but you should see similar options.
You need to set autodetect category/taxonomy:
https://www.screencast.com/t/3B40jPYRF4SA
And also enable filtering on Taxonomy Archives:
https://www.screencast.com/t/piCPyshb6
Note that you could hide the form on the shop page. If you look at the classes on the body tag for each page, does the shop have one that the category pages do not, or vice versa? In which case, using CSS to hide the form is possible.
Anonymous(Private) April 16, 2019 at 4:32 pm #208559Hi Trevor,
Thanks for your reply. I solved my problem by creating a non-Woocommerce page for showing the form and filtering the products (as in any case I needed to create a page for sorting by attributes).
I have selected ‘as an archive’ for display results method and have created a custom search results template following your documentation. The Ajax is also working as expected.
I now have a problem making the pagination work / show on the search results page:
- I have a standard WordPress loop (no custom query or WP_query) in the search-results template
- I have tried enabling and disabling the AJAX
- I am calling WP functions previous_posts_link( ) and next_posts_link( )
Any tips / documentation would be greatly appreciated.
Thanks
-
AuthorPosts