Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 1,171 through 1,180 (of 1,224 total)
  • Author
    Search Results
  • #11709

    Ross
    Keymaster

    Hey Scott

    You can customise the results.php instead of hacking – http://www.designsandcode.com/wordpress-plugins/search-filter-pro/docs/#docs-new-ajax ๐Ÿ™‚

    Also, I just added some new info the FAQs which I believe covers off some issues you were originally having, check the last question – http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/

    Glad it is up and running for you now.

    Thanks

    #11700

    Anonymous
    Inactive

    never mind…i got it. hacked “results.php”

    #10316

    In reply to: S&F and Polylang


    Ross
    Keymaster

    Hey Dirk

    Thanks ๐Ÿ™‚ To adjust the query you need to look in two files

    If you are displaying your results “as archive” then you need to look at this file:

    search-filter-pro\public\includes\class-search-filter-setup-query.php

    And if you are displaying your results with shortcode then you need to look at this file:

    search-filter-pro\public\includes\class-search-filter-get-results.php

    Let me know if you get it working ๐Ÿ™‚

    Thanks

    #9979

    Ross
    Keymaster

    Ah ok… I can see loads of potential in adding this kind of functionality to the plugin, you use a single input, or range slider, or all sorts of kinds of fields for numbers and comparing against 2 meta fields for upper and lower limits – this is pretty tricky even as a hack, but I’ll give it a go:

    So lets go with a drop down (as it already exists) – so add a post meta field to the search form UI, choose the type “choice” and create a dropdown with the values you want available.

    Next – head back to “class-search-filter-get-results.php”

    Head to line 570 with the function filter_meta_query_where. Because we have a choice field type this meta query will get be added to the query here:

    else if($meta_query['type']=="value") (line 602)

    What I would do is do a check for the meta field you set in S&F admin, and run some custom code instead… so this:

    else if($meta_query['type']=="value")
    {
    	$where .= " AND ((sf_meta_$meta_iter.meta_key = '".$meta_query['key']."' AND (";
    	
    	$meta_val_arr = array();
    	
    	foreach($meta_query['values'] as $value)
    	{
    		array_push($meta_val_arr, "sf_meta_$meta_iter.meta_value = '$value'");
    	}
    	
    	$where .= implode(" ".$meta_query['operator']." ", $meta_val_arr);
    	
    	$where .= ")))";
    }

    would be this:

    else if($meta_query['type']=="value")
    {
    	if($meta_query['key']=="SOME_KEY_NAME") //this will be the meta key you have chosen in your post meta field
    	{
    		$value = (int)$value; //cast value as a number
    		
    		//this part says - if the meta is under or equal to the value of the user input - so the field you choose in your post meta field, should be the closing time
    		$where .= " AND ((sf_meta_$meta_iter.meta_key = '".$meta_query['key']."')";
    		$where .= " AND (sf_meta_$meta_iter.meta_value <= $value))"
    		
    		//this part says - if the meta second meta key (entered manually here) is over or equal to the value of the user input
    		$where .= " AND ((sf_meta_$meta_iter.meta_key = 'SECOND_META KEY')";
    		$where .= " AND (sf_meta_$meta_iter.meta_value >= $value))"
    	}
    	else
    	{
    		$where .= " AND ((sf_meta_$meta_iter.meta_key = '".$meta_query['key']."' AND (";
    	
    		$meta_val_arr = array();
    	
    		foreach($meta_query['values'] as $value)
    		{
    			array_push($meta_val_arr, "sf_meta_$meta_iter.meta_value = '$value'");
    		}
    	
    		$where .= implode(" ".$meta_query['operator']." ", $meta_val_arr);
    	
    		$where .= ")))";
    	}
    }

    The query itself is just an SQL WHERE clause… you should be able to tell and its just added to a string $where for running later on in WP.

    Copy and paste that new code above in an editor so you can read the comments properly – I think its pretty close to what you want as a hack just requires some tweaks from you ๐Ÿ˜‰

    Good luck!

    #9949

    In reply to: Pagination


    Ross
    Keymaster

    Hey Colette

    The latest version of the plugin allows for regular pagination (which should fit in with your blog) no problem ๐Ÿ™‚

    See the included results.php file for usage.

    Thanks

    #9897

    Anonymous
    Inactive

    Dear Ross,

    I recreated this post because you flagged my previous post (https://support.searchandfilter.com/forums/topic/is-it-possible-to-use-and-over-all-the-controls-specified/) as solved and I don’t get replies on my replies.

    I looked in your codefile class-search-filter-get-results.php and printed the $args. This is what’s going wrong:

    If I tick Thailand and Indonesie this is the output of $args:
    Array ( [paged] => 1 [posts_per_page] => 16 [post_status] => Array ( [0] => publish ) [category__in] => Array ( [0] => 417 ) [meta_query] => Array ( ) [s] => boemboe [post_type] => Array ( [0] => post ) [tax_query] => Array ( [0] => Array ( [taxonomy] => post_tag [field] => slug [terms] => Array ( [0] => indonesie-nl [1] => thailand-nl ) [operator] => IN [include_children] => ) ) [orderby] => rand [order] => desc ) 1

    If I also tick ‘Vegetarisch’ the result is this:
    Array ( [paged] => 1 [posts_per_page] => 16 [post_status] => Array ( [0] => publish ) [category__in] => Array ( [0] => 417 ) [meta_query] => Array ( ) [s] => boemboe [post_type] => Array ( [0] => post ) [tax_query] => Array ( [0] => Array ( [taxonomy] => post_tag [field] => slug [terms] => Array ( [0] => vegetarisch ) [operator] => AND [include_children] => ) ) [orderby] => rand [order] => desc ) 1

    As you can see the indonesie-nl and thailand-nl slug terms are gone. That’s the reason why the filter is not working okay. Could you please help me on this one?

    Best regards

    Janno

    #9874

    In reply to: Pagination broken


    Anonymous
    Inactive

    Hey Ross,
    I’ve made last uprage and replace <?php echo paginate_links(); ?> that don’t work, by wp-pagenavi plugin. (I see you use it in your results.php plugin page)
    Because my results template as a custom post archive template have a special query that I couldn’t make work whith paginate_links function.
    So now my problem is solved.

    <div class="pagination"><?php wp_pagenavi(); ?></div>

    Thanks

    #9873

    Anonymous
    Inactive

    I’ve found that I can add the following lines to class-search-filter-get-results.php to get the results that I need.

    $args['meta_query'][] = array('key'=>'field_A', 'value' => $value, 'type'=>'NUMERIC', 'compare' => '<=');
    $args['meta_query'][] = array('key'=>'field_B', 'value' => $value, 'type'=>'NUMERIC', 'compare' => '>=');

    Obviously this is a very hacked-together solution and not necessarily the solution that I want to land on. It maybe helps to demonstrate what I’m trying to achieve, however I’d still like to be able to include inputs in the search from so that the user can specify the value of $value. Although I’m not an expert, I’m relatively comfortable using PHP, so I don’t really need a full solution that modifies the admin interface – I am happy editing code if I know where I should be looking.

    #9768

    Anonymous
    Inactive

    Hey,

    Just purchased the S&F Pro – great plugin!

    I am using the Avada theme and would like the Ajax search results to be displayed as a grid. How can I go about doing this? Should I use the existing Avada search.php template (and select the grid search results layout in the theme options) and modify it somehow? Or is there some way that I should modify the results.php template file that comes with the S&F Pro plugin?

    It seems from a previous post that you have some familiarity with the Avada theme – apologies if this is not the case.

    Thanks in advance,
    Dan

    #9336

    Anonymous
    Inactive

    Dear support,

    I have a working WooCommerce setup filled with products. It took me a while to get all the styling done. However Woocommerce is limited in search capabilities so that’s the reason why I bought search and filter Pro.

    As far as I understood i should deselect Ajax and use a page template. Mine is (relative to the theme directory) /woocommerce/archive-product.php. I think it cannot find it because it sticks to the default results.php which is located in {themedir}/search-filter/results.php.

    What am I doing wrong?

Viewing 10 results - 1,171 through 1,180 (of 1,224 total)