• Resolved nathangdavidson

    (@nathangdavidson)


    Hi,

    We’re using your plugin for the first time on this staging site.

    We’re getting an error when we try to filter by sub-brands, as below, on pages like this https://st.the-fireplace.co.uk/product-category/indoor/fireplaces/ (choose The Kelly Hoppen Collection checkbox below the product slider)

    Filters work fine for parent brands – choose Rais on this page for example https://st.the-fireplace.co.uk/product-category/indoor/stoves/

    This is the error according to my developer
    [18-Feb-2018 15:59:20 UTC] PHP Catchable fatal error: Object of class WP_Error could not be converted to string in /home/thefireplaceco/st.the-fireplace.co.uk/wp-includes/formatting.php on line 1045

    Is there anything you might suggest?

    We can’t see a way to remove sub-brands as an option from the filters, which would be a good interim measure if a fix isn’t available.

    Thanks for your time.

    Regards,
    Nathan

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter nathangdavidson

    (@nathangdavidson)

    Hello Tito,

    Any thoughts on this please?

    Nathan

    Plugin Contributor titodevera

    (@titodevera)

    Hi Nathan.

    I will check the issue as soon as possible, thanks.

    Thread Starter nathangdavidson

    (@nathangdavidson)

    Hi there,

    Any idea when you’ll be able to take a look please?

    Thanks,
    Nathan

    Hi

    I’ve been looking into this, and I think the issue is due to a tax_query using slugs.

    In classes\class-perfect-woocommerce-brands.php function pwb_brand_filter( $query ) (Line 81) if I change

            $query->set('tax_query', array(
              array (
                'taxonomy' => 'pwb-brand',
                'field'    => 'slug',
                'terms'    => $terms_array
              )
            ));

    to:

            $term_ids = array();
            foreach( $terms_array as $term_slug ) {
              $term = get_term_by( 'slug', $term_slug, 'pwb-brand' );
              $term_ids[] = $term->term_id;
            }
    
            $query->set('tax_query', array(
              array (
                'taxonomy' => 'pwb-brand',
                'field'    => 'term_id',
                'terms'    => $term_ids
              )
            ));

    Then we don’t get the fatal error and get the right results.

    Thread Starter nathangdavidson

    (@nathangdavidson)

    Hello Tito,

    Any thoughts on Jo’s suggestion please?

    Nathan

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sub-brand filter bug?’ is closed to new replies.