Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Bug in asp-tax-checkboxes.php / Patch for Core
This topic contains 2 replies, has 2 voices, and was last updated by Michael Samson 2 years, 6 months ago.
- AuthorPosts
- November 24, 2020 at 11:27 pm #30342
Hi Ernest,
I hope you’re doing well!
We found a bug in ASP today and believe it is unrelated to our modifications. I’m including below a patch we made so that you can include this in core. Once you’ve fixed this we can remove our patch.
This is the file:
/includes/views/filters/taxonomy/asp-tax-checkboxes.phpThis is our patch:
<?php /** * Overriden this template file from plugin ajax-search-pro. * To differentiate between 'Select All' and 'Article' options. * Original template considered any term with id less than 0 be the 'select all' option. * Article(standard) post format isn't a real term and hence is assigned a fake id, -200. * And thus it was also considered same as the 'select all' option, which led to issues selecting/deselcting all and article options in search filters. */ ?> <?php foreach ($filter->get() as $kk => $term): ?> <?php if ($term->id == 0): ?> <div class="asp_option_cat asp_option asp_option asp_option_cat_level-0 asp_option_selectall childtheme"> <div class="asp_option_inner"> <input id="asp_<?php echo $ch_class; ?>_all<?php echo $id; ?>" aria-label="<?php echo asp_icl_t("Select all text [" . $taxonomy . "]" . " ($real_id)", $term->label, true); ?>" type="checkbox" data-targetclass="asp_<?php echo $ch_class; ?>_checkbox" <?php echo $term->default ? 'data-origvalue="1"' : ''; ?> <?php echo($term->selected ? 'checked="checked"' : ''); ?>/> <label aria-hidden="true" for="asp_<?php echo $ch_class; ?>_all<?php echo $id; ?>"> <?php echo asp_icl_t('Hidden label', 'Hidden label'); ?> </label> </div> <div class="asp_option_label"><?php echo asp_icl_t("Select all text [" . $taxonomy . "]" . " ($real_id)", $term->label); ?></div> </div> <div class="asp_select_spacer"></div> <?php else: ?> <div class="asp_option_cat asp_option asp_option asp_option_cat_level-<?php echo $term->level; ?>" data-lvl="<?php echo $term->level; ?>" asp_cat_parent="<?php echo $term->parent; ?>"> <div class="asp_option_inner"> <input type="checkbox" value="<?php echo $term->id; ?>" class="asp_<?php echo $ch_class; ?>_checkbox" aria-label="<?php echo esc_html($term->label); ?>" <?php if (isset($filter->data['custom_name'])): ?> name="<?php echo $filter->data['custom_name']; ?>" <?php else: ?> name="<?php echo "termset[" . $term->taxonomy . "]"; ?>[]" <?php endif; ?> id="<?php echo $id; ?>termset_<?php echo $term->id; ?>" <?php echo $term->default ? 'data-origvalue="1"' : ''; ?> <?php echo($term->selected ? 'checked="checked"' : ''); ?>/> <label aria-hidden="true" for="<?php echo $id; ?>termset_<?php echo $term->id; ?>"> <?php echo asp_icl_t('Hidden label', 'Hidden label'); ?> </label> </div> <div class="asp_option_label"> <?php echo $term->label; ?> </div> </div> <?php endif; ?> <?php endforeach; ?>
I’ve attached our patched file here for your convenience as well.
All my best,
~ Michael
Attachments:
You must be logged in to view attached files.November 25, 2020 at 10:47 am #30347Hi,
Thank you very much, you are correct. That was a mistake, I will make sure to implement this fix in the ucoming release. Thank you again!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 25, 2020 at 11:05 am #30349Hi Ernest,
Our pleasure. The credit goes to our senior developer who found this issue and patched it.
Thank you for including the fix in core. I’ll keep an eye out for it!
All my best,
~ Michael
- AuthorPosts
You must be logged in to reply to this topic.