A few issues and fixes
-
Thanks for this plugin π
I’ve encountered a couple of issues. The first is just a PHP warning when you have error display on: The method
wbc_option_woof_settings()should check that$wp_query->query_vars['product_cat']is set before running the rest of its code.There is another issue that causes the plugin to not do what it should. It is caused by line 86 of the pluing, in the same
wbc_option_woof_settings()method. The method should not be looping through each member of the$category_filtersarray because that array contains categories that may not be part of (or parent to) the categories being displayed. The$category_filtersarray should be restricted to only the categories being displayed.Here is a re-write of the method which fixes these 2 issues:
public function wbc_option_woof_settings( $value ) { global $wp_query; if (!isset($wp_query->query_vars['product_cat'])) { return $value; } $options = get_option( 'woof_by_category_settings' ); // Get current settings. $cats = explode( ',', $wp_query->query_vars['product_cat'] ); foreach ( $options as $group ) { if (!$group['category'] || !$this->has_parent($group['category'], $cats)) { continue; } foreach ($value['tax'] as $filterName => $isActive) { if (!$isActive || in_array($filterName, $group['filters'])) { continue; } unset($value['tax'][$filterName]); } } return $value; }
The topic ‘A few issues and fixes’ is closed to new replies.