Ross

Forum Replies Created

Viewing 10 posts - 10,331 through 10,340 (of 10,351 total)
  • Ross Moderator in reply to:
    Date range submits before 2nd date entered
    #826

    Hey again Ellen, there was a problem actually with the form submitting when the date fields are updated even when Ajax is off – so I fixed this behaviour.

    There was also a problem with the Ajax version which you highlighted, which causes a refresh before a user has selected both dates – this has also now been fixed.

    I’ve emailed you an updated zip with these fixes in – they’ll be making their way in to the next official update also.

    Thanks ๐Ÿ™‚

    Ross Moderator in reply to:
    Results showing from excluded categories
    #825

    Hey Ellen

    To exclude categories by ID you need to list them (sorry I wasn’t clearer) here:

    
    $query->set( 'cat', '-2' );
    

    This removes categories with the id of 2. The minus number means “exclude”. If you want multiple categories then comma separate them:

    
    $query->set( 'cat', '-1,-23,-8' );
    

    And yeah to make the categories disappear from all main queries then remove that line. There was one problem with my example actually – I needed to add an is_admin check – so the full code for you would be something like:

    function exclude_category( $query ) {
    	global $sf_form_data;
    	//if ( $query->is_main_query() && !is_admin() ) - use this line instead to exclude cats from all queries
        if ( $sf_form_data->is_valid_form() && $query->is_main_query() && !is_admin() )
    	{
            $query->set( 'cat', '-2,-4,-10,-6' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );
    

    Hope that helps!

    Ross Moderator in reply to:
    Results showing from excluded categories
    #821

    Hey Ellen

    Currently there is no way to define “defaults” for the form to use except for post types..

    I do plan on adding this in at some stage, but for now you will have to use pre_get_posts hook in order to modify your query (place this in your functions.php):

    function exclude_category( $query ) {
    	global $sf_form_data;
    	
        if ( $sf_form_data->is_valid_form() && $query->is_main_query() )
    	{
            $query->set( 'cat', '-2' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );

    You’ll see in there is $sf_form_data->is_valid_form() – this tells us we are on a S&F search form so to only modify the query then.

    This statement will affect all search & Filter forms however, so if you are using more than one form on your site you will need some more conditional statements.. let me know if this is the case?

    Thanks

    Ross Moderator in reply to:
    Ajax auto submit
    #814

    No problem ๐Ÿ™‚

    Ross Moderator in reply to:
    How to not show all results
    #812

    Hey Amin there’s not unfortunately – but something I’m working on adding in an update soon (hopefully the next couple of days) ๐Ÿ™‚

    Let me know how you get on with the rest.

    Thanks

    Ross Moderator in reply to:
    Search & Filter Pro on Woocommerce doesn't affect the loop
    #810

    Hey Dmitry not sure what the problem is exactly but for starters, you have the checkbox “use custom template”, but then you don’t have any filename specified…

    Try it with search.php and see if you get some valid results? (I’m sure the layout will be wrong).

    Regardless of this, I’m pretty sure you should be seeing the URL change.

    In some cases when the URL does not change its because WordPress cannot redirect after submitting the form – and this is normally caused by a hidden error in WP, with your theme or your plugins…

    Try installing debug bar and submitting the form, and try to see if there are any errors. If you have any errors, then these will need to be fixed first.

    Let me know the results.

    (Ps seems we are on different time zones, I won’t be back online now until tomorrow).

    Ross Moderator in reply to:
    Ajax auto submit
    #803

    Hey Tim, a couple of bits of good news for you ๐Ÿ™‚

    1) There was a conflict with Custom post type UI – we are both using the same menu position in our plugin, so one will be shown and one will be hidden… I will email you an updated file with this fix..

    2) Your Ajax only working once… I was just setting S&F again on another site and ran in to this exact issue (well its not an issue, just an oversight on my part). Essentially it was the content selector I was using to load results (#content).

    The default setting of #content *seemed* to work ok but I was getting the same problem as you. The problem is the selector is supposed to target your content area only (ie your list of posts/results) – your search widget is not supposed to be inside this selector otherwise there will be problems.

    For my woocommerce setup I changed this to #main and it worked fine – this is because the div with the ID of #main did not include the search widget itself.

    Hope that makes sense? ๐Ÿ™‚

    Ross Moderator in reply to:
    Ajax auto submit
    #796

    Hey Tim, no idea about this one! I doubt it has anything to do with AJAX, but this could be a separate issue…

    I’ll try to do a test with that plugin and S&F and see. In the meantime let me know of any updates you may have with the AJAX refresh.

    Sleep well haha!

    Ross Moderator in reply to:
    How to not show all results
    #795

    Ok this is one I’ve given some thought to…

    Basically.. if a user is using the search form, and then deselects/resets everything – they will expect all the results to be shown – because they haven’t filtered the results by any criteria…

    So changing this in the search form is not recommended.

    I think what you are looking for is a kind of landing page for search – the first time you go on the search page, you will have a custom message with the search form, then the user interacts with the search form and the results begin loading.

    In this case I would recommend the following steps:

    1. Create a new Page where users will begin all their searches.
    2. Make sure this page uses the exact same template as the search results – if you cannot select the page template from the drop down list follow these steps:
      • In your theme folder, duplicate your template and name it something else (by default this is search.php so duplicate search.php and call it search-landing.php.
      • Edit search-landing.php and add this to the top of the file (as per WP Codex here):
        <?php
        /*
        Template Name: My Custom Search Landing Page
        */
        ?>
        
      • Now go back to your page, and you should be able to select a page template called “my custom search landing page” – select this.
      • This will be your landing page – you can modify this template as needed…! You can then perform a search from this page and user will be redirected to the proper search page which will display all (unfiltered) results if desired.

    Let me know how you get on! ๐Ÿ™‚

    Ross Moderator in reply to:
    Ajax auto submit
    #792

    Hey Tim, its seems as though the search functionality is working fine, and even the Ajax is working fine for 1 or 2 submits…

    So the next logical conclusion I can take from that is that it is in fact a JavaScript error…. have you tried looking at the console (using firebug for example) to see if any errors are being generated when you submit the forms?

    If one JavaScript error is thrown all subsequent JS will not work properly, so it seems like after a certain amount of time, or depending on submits/refreshes that there is a JS error generated.

    Check the console and report back any errors you find ๐Ÿ™‚

Viewing 10 posts - 10,331 through 10,340 (of 10,351 total)