Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi @danielaromeo,

    I’m sorry for the long time on this reqeust.

    Please, can yo ushare with me a screenshot of attribute hierarchy ? In this way I can reproduce it in my local.

    Let me know.
    Have a nice day
    YITH

    Thread Starter danielaromeo

    (@danielaromeo)

    Hi YITH,
    thank you for your reply.
    Here is the screenshot: https://www.awesomescreenshot.com/image/2456967/1894465b462fde1247693d6683b62489
    Please let me know if you need anything else to test.

    Thank you!
    Daniela

    Plugin Author YITHEMES

    (@yithemes)

    Hi @danielaromeo,

    please, look this post in our Help Center: Ajax Product filter – Attributes are no longer hierarchical than version 3.0.x of WooCommerce

    In latest WC version seems that attribute doesn’t support hierarchy, too. Probably your issue are related to this.

    Please, can you try this solution ? Thanks.

    I look forward to hearing back from you
    YITH

    Thread Starter danielaromeo

    (@danielaromeo)

    Hi YITH,
    thank you for your reply.
    After the upgrade to WooCommerce 3.0.x, I noticed the hierarchy was no longer in WP admin WC attributes page, so I overwrote the following file in my child theme for WooCommerce: https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-post-types.php#L193 , changing “false” to “true” and that did the trick.
    Now I removed it and added the code you sent me in functions.php file, but the hierarchy is always messed up.
    Anyway, the issue was there even before the upgrade to WC 3.0.x, the problem arised when upgrading your plugin to v3.3.1, it was working with older v.2.9.2.
    I’ve also seen this topic: https://www.ads-software.com/support/topic/filters-labels-order/ . As all our subitems labels start with a “>”, and alphabetically, it comes first than any alphanumeric char, I tried removing the “>” char, but the subitem is just shown at the bottom of all the subitems, but not under the correct parent.
    I hope all the above information could help you understanding what the cause could be.

    Thank you!
    Daniela

    • This reply was modified 7 years, 10 months ago by danielaromeo.
    • This reply was modified 7 years, 10 months ago by danielaromeo.
    Plugin Author YITHEMES

    (@yithemes)

    Hi,

    Please, update the ajax product filter plugin to latest version and try to read this post: https://support.yithemes.com/hc/en-us/articles/115000123814-Ajax-Product-filter-Attributes-are-no-longer-hierarchical-than-version-3-0-x-of-WooCommerce

    probably this can help you to solve your issue.

    I’m sorry for the long time on this request but the issue with attribute hierarchy in latest wc version take us a long time to understand a find a valid workaround for this.

    Let me know
    Have a nice day
    YITH

    Thread Starter danielaromeo

    (@danielaromeo)

    Hello YITH,
    that is the same link you sent me in the previous post. I had already added that code, but it didn’t work.
    Please let me know if I can do something else.

    Thank you.
    Daniela

    Plugin Author YITHEMES

    (@yithemes)

    Hi Daniela,

    this is very strange because other users have this issue but are related to WooCommerce 3.0.x that change the hierarchy type of attribute so we solve all the issue with the previous code.

    Another code that you can try is this:

    add_filter( ‘yith_wcan_skip_layered_nav_query’, ‘__return_true’ );

    that force the plugin to use the layered nav query of WooCommerce or your theme instead of custom query of our plugin.

    Try this and let me know….I hope that works now.
    Have a nice day

    YITH

    Plugin Author YITHEMES

    (@yithemes)

    Hi @danielaromeo,

    probably you have an issue with the functions.php file of your theme. I’m sure that the problem are linked to product attribute hierarchy. For this you can create a little plugin to restore it, please follow this instruction:

    1. Create a file called init.php

    2. Past this code inside it:

    /*
    Plugin Name: YITH Support Restore Attribute Hierarchy
    Description: YITH Support Restore Attribute Hierarchy
    Author: YITHEMES
    Version: 1.0.0
    Author URI: https://yithemes.com/
    */
    /*
     * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
     * that is bundled with this package in the file LICENSE.txt.
     * It is also available through the world-wide-web at this URL:
     * https://www.gnu.org/licenses/gpl-3.0.txt
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
        exit;
    } // Exit if accessed directly 
    
    add_action( 'init', 'yith_woocommerce_register_taxonomies_hack', 4 );
    
    if( ! function_exists( 'yith_woocommerce_register_taxonomies_hack' ) ){
        function yith_woocommerce_register_taxonomies_hack(){
            if( function_exists( 'wc_get_attribute_taxonomies' ) && $attribute_taxonomies = wc_get_attribute_taxonomies() ) {
                foreach ($attribute_taxonomies as $tax) {
                    if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) {
                        add_filter( "woocommerce_taxonomy_args_{$name}", 'yith_woocommerce_taxonomy_product_attribute_args' );
                    }
                }
            }
        }
    }
    
    if( ! function_exists( 'yith_woocommerce_taxonomy_product_attribute_args' ) ){
        function yith_woocommerce_taxonomy_product_attribute_args( $taxonomy_data ){
            $taxonomy_data['hierarchical'] = true;
            return $taxonomy_data;
        }
    }

    3. Create a new folder called yith-support-restore-attribute-hierarchy under wp-content/plugins and past the file init.php

    4. Go on WordPress dashboard and enable the plugin YITH Support Restore Attribute Hierarchy

    5. Go in YITH Plugins > Ajax Product Filter and set the sort By option to WooCommerce Default value.

    Let me know if all works fine or not.
    Have a nice day

    YITH

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hierachy messed up in dropdown filter’ is closed to new replies.