This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Mandatory dropdown filter enable the search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Mandatory dropdown filter enable the search Reply To: Mandatory dropdown filter enable the search

#25124
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

1 & 2 – A next patch is out within 48 hours, this feature is planned for the one after that. You can follow the public development log here: https://trello.com/b/BUNOEob3/asp
The patch that should contain this feature is planned for 14th of January.

3. Well, that is a bit difficult to explain, as it may require modifications in multiple files. I might be able to suggest a very basic solution to start off. I have constructed a custom code, that should prevent the trigger unless there is a non-empty selection.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_action('wp_footer', 'asp_custom_script', 9999999);
function asp_custom_script() {
  ?>
  <script>
  jQuery(function($){
    $('.asp_w form fieldset select').off();
    $('.asp_w form fieldset select').on('change', function(e){
      if ( $(this).val() != -1 && $(this).val() != 0 && $(this).val() != '' ) {
        var $c = $(this).closest('.asp_w');
        var id = $c.data('id');
        var instance = $c.data('instance');
        ASP.api(id, instance, 'searchFor'); 
      }
    });
  });
  </script>
  <?php
}