Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Add existing parameters of query to shortcode

Viewing 10 posts - 1 through 10 (of 17 total)
  • Sergey
    #26464

    For sample, I need to integrate this plugin (Search & Filter Pro) with WP-SHOP plugin: site of plugin.

    Work logic of this plugin in my site:
    Posts-“categories” have shortcodes of shop.

    Handler of this shop shortcode do:
    Show data of some posts in same category (or same tag): pictures, some additional fields (same as price).

    Part of handler’s code (can be overwritten in theme)

    $posts_per_page = $this->rowCount * $this->colCount;
    
    if (isset($this->category))
    {
    	$selection = "cat={$this->category}";
    }
    else
    {
    	$selection = "tag={$this->tag}";
    }
    global $post;
    $page_id = $post->ID;
    
    $if_child = get_post_meta($page_id, 'collections_view', true);
    
    if ($if_child == 'on')
    {
    	
    	$orderby = "meta_key=orderbymeta&orderby=meta_value_num";
    }
    else
    {
    	
    	$orderby = "orderby=post_title";
    	
    }
    ?>
    
    ...
    
    <?php 
    if (function_exists('wpfp_link')) { wpfp_link(); }
    
    $query = new WP_Query("{$selection}&showposts={$posts_per_page}&post_type=any&{$orderby}&order=ASC&nopaging=true");

    So I need to pass $selection “as is” (maybe filtered to avoid hijacking) in Search & Filter Pro shortcode.

    Or, another way:
    Provide API to change Search & Filter Pro queries “on the fly”.

    Ross Moderator
    #26490

    Hey Sergey

    You can modify the query on the fly by modifying the parameters that are passed to Search & Filter queries – its not so well documented but mentioned here with example in the upgrade notes:

    http://www.designsandcode.com/documentation/search-filter-pro/2-0-upgrade-notes/#No_more_pre_get_posts

    I’m hoping this will do what you need 🙂

    Thanks

    Sergey
    #26518

    But I want to use one Search & Filter form for different collections 🙂

    Collection = all posts with same category or same tag.

    Algorythm of WP-Shop.

    In post-category I put shortcode of “vitrine”. This shortcode puts all posts with price and same category (or tag).

    I can modify template of “vitrine” and put shortcode of Search & Filter there.

    But same template of “vitrine” works on different collections 🙁 So I need to attach cat={$this->category} or tag={$this->tag} from template, not statically predefined filter.

    Ross Moderator
    #26651

    Hey Sergey

    I think we’re getting confused.

    So, what you would like to do (as an example) is pass the category through to S&F, in the shortcode or something similar.

    Well, this is not yet possible, but you can use the shortcode like you mention above, and then use the filter sf_edit_query_args in the link above to limit the tag/category to whatever you like.

    So in this way it is dynamic and according the cat/tag you supply via some custom php code.

    Does that make sense?

    Thanks

    Sergey
    #26679

    Sorry, I can’t go by this way, because I can’t pass category or tag into sf_edit_query_args 🙁

    Category isn’t fixed, it get from post with vitrine shortcode. So different vitrines have different categories, but shortcodes in the posts can be same!

    Ross Moderator
    #26865

    I’m not sure I follow what you are trying to do then.

    Are you trying to use the vitrine shortcode to display your results?

    I’m not familiar with WP Shop.

    Thanks

    Sergey
    #26890

    No, I want to use vitrine shortcode with overwritten behavior to display search form with results instead of vitrine default view, but results must be belong to this vitrine.

    Ross Moderator
    #27194

    Hey Sergey

    As I’m not familiar with that plugin, it makes understanding what you are trying to achieve very confusing – I have no idea what the vitrine shortcode is or truly how it works.

    If I find some time I’ll take a look to get a better understanding but for now I would say it sounds like the two plugins can not be used in that way together.

    Thanks

    Sergey
    #27573

    Let’s try one time more to explain you the problem.

    Vitrine shortcode is:

    For sample, I have page http://vkplitka.ru/zerkalnaya-plitka/

    Vitrine shortcode is
    [vitrina zerk-plitka 3 420 99 99]

    where zerk-plitka is category or tag of goods.

    Plugin checking, is it category, or tag, then render “vitrina” template. Plugin already have interface for intercepting this call and render file “vitrina.php” from theme folder instead of plugin folder.

    So I trying to implement in template “vitrina.php” in theme instead of vitrine “by default” search form and search results, but ONLY which belongs to this vitrine.

    Because all categories and tags rendered by ONE template vitrina.php, then I should somehow to put this argument to search shortcode FROM file vitrina.php.
    So I see this can be done, if I can put additional “boundary conditions” in your search shortcode.

    Are you understand my requests now? Maybe you need additional clarifying?

    Sergey
    #28132

    Hello, Ross.

    If you don’t want to implement my feature request, then this plugin completely unusable to me 🙁

    I want moneyback then 🙁 Or you can implement this little feature for me ^^

    Thanks.

Viewing 10 posts - 1 through 10 (of 17 total)

The topic ‘Add existing parameters of query to shortcode’ is closed to new replies.