• Resolved squarestar

    (@squarestar)


    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_filters array because that array contains categories that may not be part of (or parent to) the categories being displayed. The $category_filters array 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;
    }
    • This topic was modified 8 years, 7 months ago by squarestar. Reason: formatting
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author kaggdesign

    (@kaggdesign)

    Thank you for your comments.

    We cannot return if $wp_query->query_vars['product_cat'] is not set. This will cause that all filters will be shown on /shop page. I have implementned this check in a different way.

    I have reworked code of wbc_option_woof_settings(), has_parent(), and setup_fields() to meet your notes, eliminate some other problem, and allow filtering on /shop page.

    It would be good if you find a time to test plugin again in version 1.2. Thank you in forward.

    Thread Starter squarestar

    (@squarestar)

    Thanks for the update. That has certainly helped. However I’m getting a few problems still.

    Please try the following:

    1. Go to http://apex.btmm-dev.com/product-category/gc-columns/
    2. Use any filter (e.g., filter by Brand “Beta-Dex”)
    3. Click the “Reset” button for the Smart Column Selector

    The product list reloads but the filter still remains hidden. The same thing happens if you click the red X with the “beta-dex” text above the product list instead of hitting Reset.

    Another minor issue: on this page: http://apex.btmm-dev.com/products/ there is a PHP warning from one of the plugin’s methods.

    Plugin Author kaggdesign

    (@kaggdesign)

    Frankly speaking, I do not see any problem specified and any filter hidden/shown. Selection of “Beta-Dex” doesn’t change category. It is “gc-columns” as far as I can see. So no action can be expected from WOOF by Category plugin.

    And I do not see any php warnings on the page and in console.

    Could you create Minimal, Complete, and Verifiable example?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘A few issues and fixes’ is closed to new replies.