Uncheck all boxes in filter

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Uncheck all boxes in filter

This topic contains 16 replies, has 2 voices, and was last updated by  Ernest Marcinko 2 years, 3 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #8118

    fud
    Participant

    Hello,

    I am trying have all the boxes on the front-end unchecked by default when the page loads. I referred to this post:

    https://wp-dreams.com/forums/topic/checkuncheck-all-taxonomy-term-selectors-on-frontend/

    but it did not work for me, as all the boxes were still checked when I reloaded the page. Maybe it is because I am enabling the results to be auto-populated in the beginning as well? Perhaps I am missing a step?

    Thanks!

    #8119

    Ernest Marcinko
    Keymaster

    Hi!

    It depends on which checkboxes.

    – For categories the excluded categories are unchecked
    – For taxonomy terms you can check/uncheck the ones you need – same for tags as well

    Does it work on the preview window?
    Does it work on another search instance, if you create one?
    Have deleted the site cache? Usually that is the cause of these types of issues.

    If none of this helps, then I need to take a look at the problem directly. You can add temporary back-end and FTP details by editing your first post and filling out the details, or posting them and marking the “Set as private reply” checkbox to keep them safe.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8124

    fud
    Participant

    Hi,

    Thanks for your response, I've actually figured it out! A couple of things though:

    1) Just something I discovered, I would like to have all the checkboxes unchecked initially, which I've been able to do, but on my page I still would like the results box to be autopopulated with content.

    The way I have it right now, the search and results are in two columns. When the user loads the page, content should show in the results box even though no check boxes are clicked. Then when a user clicks a checkbox, the results box should update accordingly. When I looked at the settings, I saw that the autopopulate option DOES look at the front end options, which means that if I set the boxes to be unchecked, the results box will be empty. Is there a work around for this?

    2) When I do check the boxes so that the results box is populated, the entire content of the post shows up as well. When I changed the settings in Layout Options -> Results layout -> Show description (content) in results? to True, and changed the length to 100, it still displayed the entire description. This behaviour was weird as it was working normally before.. :/

    And last thing (hopefully):

    3) I currently have many categories and sub-categories for a post type, and right now it seems as if they are being registered all as one taxonomy. So, if I include all of the categories and subcategories to be included in the filter, they will all be checkable and in heirarchical format. However, what I would like is to have the category just be a heading and the subcategories be clickable. Is there a way to do this, or will I have to create custom taxonomy?

    Thank you so much, and sorry for all the text!

    #8136

    fud
    Participant

    You can actually disregard 3), I just created custom taxonomy.

    Also, for 2), the content that shows up is actually from a custom field we created with the ACF plugin.

    Hope that helps.

    #8137

    Ernest Marcinko
    Keymaster

    Hi!

    1. Well this is not possible without touching the plugin code. In case you need it for the engine you talked in your previous ticket (redirection from header to another search), then I would do the following:

    – Open up the wp-content/plugins/ajax-search-pro/includes/classes/search/search_content.class.php file and scroll down to line 590, which should be an empty line. Put this code there:

        if ( isset($_GET['ignore_op']) ) return "";

    – Add the &ignore_op=1 parameter to the redirection URL of the header search instance. So if you previously had:

    catalogue/?asp_id=5&asp_s={phrase}

    then change it to:

    catalogue/?asp_id=5&asp_s={phrase}&ignore_op=1

    2. I'm not sure why, but in this case try to turn off the “Display the description context?” option on the Layout Options -> Results layout panel: https://i.imgur.com/I3JZbUu.png, and make sure that the description length is set to 100. Let me know if that doesn't help.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8138

    fud
    Participant

    Hello,

    Thanks for your response.

    Yes that was the problem! If both the “Show description (content) in results?” and “Display the description context?” options are both set to on, then the entire description shows up, but then if I set “Display the description context” to off, then it works fine.

    Thanks again!

    #8141

    fud
    Participant

    Hello,

    So I took a look at the search_content.class.php file, and line 590 isn't an empty line for me..

    #8153

    fud
    Participant

    Hi,

    I was thinking maybe I have another version of the plugin? Lines 589 to 594 are as follows for me:

    if ( ! isset( $options['categoryset'] ) || $options['categoryset'] == “” ) {
    $options['categoryset'] = array();
    }
    if ( ! isset( $options['termset'] ) || $options['termset'] == “” ) {
    $options['termset'] = array();
    }

    Thanks!

    #8164

    Ernest Marcinko
    Keymaster

    Yes, perhaps the version is different, but some client programs use different numbering (or doesn't count double emptied lines in some cases).

    Try putting it just above the line:

    if ( ! isset( $options['categoryset'] ) || $options['categoryset'] == ” ) {

    which I guess is 589 in your file.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8167

    fud
    Participant

    Thanks for your response.

    If I have a separate search form (not the one in the header) will this code still work?

    For example, on my catalogue page, I have a search and filter form. The filters are set to be visible and this is where I want all of them to be unchecked but still have all the content in the results box.

    Hope that makes sense! I will try your fix in the meantime.

    #8172

    fud
    Participant

    So I tried putting that line in the code, and then instead of putting &ignore_op=1 parameter to the redirection URL of the header, I just turned the redirect on for the catalogue search instance appended it to that one.

    Unfortunately it did not work for me 🙁

    • This reply was modified 2 years, 4 months ago by  fud.
    #8174

    Ernest Marcinko
    Keymaster

    It won't work that way for sure. The “&ignore_op=1” additional parameter for the header search is mandatory. The page that it redirects to will recieve the $_GET['ignore_op'] variable, thus the catalogue instance as well. So it will recognize that this particular call doesn't need filtering. If it's not there, it won't know to ignore filtering.
    Any subsequent filtering with the catalogue search will not send this query parameter again, thus the filter is active then.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8177

    fud
    Participant

    So I made those changes and this is what is happening right now:

    1) If user is searching in the header with all the filters checked, and they hit enter, the search is redirected to the Catalogue page however no results show up because no filters on the catalogue page are checked. (But we would ideally want results to show)

    2) If user loads the Catalogue page directly, all the filters are unchecked and no results are shown. (But we would want all content to show)

    I guess our ideal case would be:

    When no filters are checked or when all filters are checked, we would want all content to be shown in the results box. The search should also search in all content even though nothing is checked.

    • This reply was modified 2 years, 3 months ago by  fud.
    #8185

    fud
    Participant

    I was wondering if there was any update on my case.

    All I want is for all of the results to display if there is no filter checked, and if there is every filter checked. The rest of the tool should work as usual. Please let me know if this is possible. Thanks.

    #8215

    Ernest Marcinko
    Keymaster

    Hi!

    Can you please update your ticket with login and FTP details? I'm not 100% sure if this is possible, but without seeing your actual setup it's really hard to suggest anything. I will definitely have to do a modification to the plugin to make this work (if possible).

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.