A question and possibly a bug

Home Forums Product Support Forums Ajax Search Pro for WordPress Support A question and possibly a bug

This topic contains 4 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31762
    Jforrester8596
    Jforrester8596
    Participant

    Hello. First the possible bug.. when creating a filter for check boxes that have a multi-level parent/child hierarchy, I select the option for child terms to be “unchecked” by default, but no matter what I do, whenever a parent box is checked, it opens all the child levels below it and has them all “checked” as well. Do you know how to fix this?

    Also, is there a way to do multistep dropdowns for hierarchical categories? I have hundreds of categories (it’s a vehicle database) and the current WOOF filter I have does a nice mutlistep drop down where I select the vehicle year, then a new dropdown appears of all the vehicle makes (child categories), then when I select the vehicle make a new dropdown appears for all the vehicle models (next level of child categories) and so on.. I can’t seem to figure out how to do that with your plugin. Please advise if this is possible. Thank you in advance.

    Josh

    #31772
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    1. I suspect you mean this option? That is supposed to do that – to hide the child terms, whenever the parent term is unchecked.
    When the parent is checked, then all the subcateries get checked as well – but that regardless if this option is enabled or not.

    2. I’m afraid not yet. The filters section is at a major rework. Once we can finish that, we will continously add new features – including the dynamically chaning drop-downs.

    Best,
    Ernest Marcinko

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


    #31806
    Jforrester8596
    Jforrester8596
    Participant
    You cannot access this content.
    #31809
    Jforrester8596
    Jforrester8596
    Participant
    You cannot access this content.
    #31825
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you very much for the details!

    I’m afraid I can’t access the site, it requires a .htaccess login. I’m not sure if there is a way to prevent this behavior either, because it is handled programmatically within a function. If I was to recommend a custom code to not check the checkboxes, then it would also prevent opening the parent/child structures, as it is handled at the same time.

    You could try maybe this custom code:

    add_action('wp_footer', 'asp_api_sample_code');
    function asp_api_sample_code() {
    	?>
    	<script>
    	jQuery(function ($) {
    		var settingsCheckboxToggle = function ($node) {
    			var $parent = $node;
    			var $checkbox = $node.find('input[type="checkbox"]');
    			var lvl = parseInt($node.data("lvl")) + 1;
    			var i = 0;
    			while (true) {
    				$parent = $parent.next();
    				if ($parent.length > 0 &&
    					typeof $parent.data("lvl") != "undefined" &&
    					parseInt($parent.data("lvl")) >= lvl
    				) {
    					if ($checkbox.prop("checked")) {
    						$parent.removeClass("hiddend");
    					} else {
    						$parent.addClass("hiddend");
    					}
    				} else
    					break;
    				i++;
    				if (i > 400) break; // safety first
    			}
    		}
    		$('.asp_option_cat input[type="checkbox"]').off('asp_chbx_change');
    		$('.asp_option_cat input[type="checkbox"]').on('asp_chbx_change', function (e) {
    			settingsCheckboxToggle($(this).closest('.asp_option_cat'));
    			var id = $(this).closest('.asp_w').data('id');
    			var instance = $(this).closest('.asp_w').data('instance');
    			ASP.api(id, instance, 'searchFor');
    		});
    	});
    	</script>
    	<?php
    }

    It is a replication of the original, but I removd the part where the checkboxes are manipulated. 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!

    Best,
    Ernest Marcinko

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


Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.