Forums › Forums › Search & Filter Pro › Add existing parameters of query to shortcode
Tagged: feature request
- This topic has 16 replies, 2 voices, and was last updated 9 years, 8 months ago by
Ross.
-
Anonymous(Private) October 25, 2015 at 5:23 pm #28170
Hello Ross.
You do not give evaluation version with limited time usage or same. Yeah, WP_SHOP is very unpopular plugin. But site have more than 20.000 goods, so it hard to migrate to Woocommerce etc. But your plugin have lack of documentation, and your demos give me only frontend of how plugin works.
So I can only guess will your plugin work with WP_SHOP or not.
Before a refund will be granted, you must allow us to try and help solve any problem you have by opening a support ticket.
I opened this support ticket… This topic.
If issue is: you doesn’t understand how plugin is work, then:
1) I can translate all docs from http://wp-shop.ru/ to English, but my translation may be awful ๐ I can read English, but can’t speak English properly ๐OR:
2) Just implement “Add existing parameters of query to Search&Filter PRO shortcode”. I can put technical task to you as many specifically, as you wish.
This task:
Once youโve created your Search Form you will want to add it to your theme/posts.
As a ShortcodeAll Search Forms can be displayed using a shortcode. Click on
Search & Filter
in your admin sidebar to list all your Search Forms, their shortcodes will also be displayed.To use within your theme files simply call the
do_shortcode
function with the shortcode provided from the admin screen:<?php echo do_shortcode(‘[searchandfilter id=”1″]’); ?>
I need Search&Filter PRO shortcode have optional parameter
limitation
as like: [searchandfilter id=”1″ limitation=”$additional_selection”].
Your plugin should validate this parameter, and if it’s valid (like category=zerk_plitka), just add it to query “as is”. Other implementation (how to use it) is my problem ๐OR:
3) I can implement this to your plugin, if you will implement my patch into next versions of Search&Filter PRO.
Thanks.
Ross Moderator(Private) October 29, 2015 at 6:24 pm #28566Hi Sergey
To answer your questions:
1) As mentioned, the plugin is working if you follow the instructions here:
And you will be able to search your products – but I guess not directly one WP-Shop shop page – but it will be able to search your product post type – then the layout / integration would be upto you.
2) There is a filter which allows you to modify the S&F query, so maybe you could use this to add your own custom parameters to the search query – kind of like you mention in the shortcode:
3) I’m not sure I wan’t to include 3rd party code in the plugin without careful consideration.
What I would be happy to do is, if you can find a working solution, implement some filters in the next version of S&F, which allow your modifications to work – which means you can continue to upgrade S&F with your modifications via filters staying in tact.
Let me know!
Thanks
Ross Moderator(Private) November 3, 2015 at 4:23 pm #28855Hi Sergey
Its just the same as the
$args
object you pass to a newWP_Query
– so this link should provide you with the necessary options:https://codex.wordpress.org/Class_Reference/WP_Query
To take their category example and apply it to the S&F filter:
https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters=
<?php function sf_filter_query_args( $query_args, $sfid ) { //if search form ID = 225, the do something with this query if($sfid==225) { //modify $query_args here before returning it //only show results within categories with these IDs $query_args['cat'] = '2,6,17,38'; } return $query_args; } add_filter( 'sf_edit_query_args', 'sf_filter_query_args', 10, 2 ); ?>
Thanks
Ross Moderator(Private) November 3, 2015 at 5:01 pm #28862Hi Sergey
Yeah I got it the filter wrong because its not supposed to really be used ๐ The filter I actually provided a code sample for is what you *might* want.
You can use this to modify the query in many different ways – so you can restrict by certain categories, change date range, or use custom meta queries.
So, programmatically you can detect the various search parameters from the other plugin, and feed them in through this filter. As long as you call the filter before either the search form or search results are displayed.
The filter you mention actually is not yet documented as right now its not intended for general use – but all it does it take an array of Post IDs which the search results will be limited to.
Thanks
-
AuthorPosts