Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    When I see the code that I gave you,it seems that just the functions names are from Yith, but I don’t think that the code itself is related to the YITH plugin…

    Try to put this code in the functions.php of your child theme, without any changes, and see if it’s working.

    (But beware, it seems that Woocommerce no longer supports this option. That said it works well on my website)

    Let me know ??

    Hi Mflexwala,

    You need to change the line 193 in the file “./plugins/woocommerce/includes/wc-class-post-types.php” in order to see the “parent” box on the attributes, from:
    'hierarchical' => false,
    to
    'hierarchical' => true,

    But this line is gonna reset itself automatically if you update Woocommerce…

    If (like me) you’re using the YITH Ajax Product Filter, and you don’t want to do this modification after every Woocommerce update, you can add this code at the end of your “Functions.php”:

    if( function_exists( 'WC' ) ){
        add_action( 'init', 'yith_woocommerce_register_taxonomies_hack', 4 );
    
        if( ! function_exists( 'yith_woocommerce_register_taxonomies_hack' ) ){
            function yith_woocommerce_register_taxonomies_hack(){
                if( $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;
            }
        }
    }

    Source: https://support.yithemes.com/hc/en-us/articles/115000123814-Ajax-Product-filter-Attributes-are-no-longer-hierarchical-than-version-3-0-x-of-WooCommerce

    • This reply was modified 7 years, 6 months ago by dino777.
    • This reply was modified 7 years, 6 months ago by dino777.
    Thread Starter dino777

    (@dino777)

    Hello,

    I add this code to my functions.php and revert the modification I made in wc-class-post-types.php, and it’s working again.

    Thanks a lot for your help (and also to the YITH dev team ?? )

    Thread Starter dino777

    (@dino777)

    Hi,

    It’s working with your new version, but I also had to change the line 193 in the “./plugins/woocommerce/includes/wc-class-post-types.php” in order to see the “parent” box on the attributes, from:
    'hierarchical' => false,
    to
    'hierarchical' => true,

    Now, I can define a child/parent attribute again and your plugin let me filter them…

    Maybe you need to upgrade this class directly from your plugin too, I think Woocommerce change this in a recent update…

    Thread Starter dino777

    (@dino777)

    Hello,

    I’m really sorry to have bother you, the problem wasn’t your plugin.

    The problem was found today into the WordPress’s database:
    The plugin used to add “hierarchy” support for the attributes was “custom-made” and don’t work any more. So your plugin don’t show any sub-attributes, because it can’t detect them any more… There are none! All attributes were automatically switched to “Parent”. ??

    I wish this option was added by default with Woocommerce or include with your plugin (maybe in the premium version?), but. I think I just have to find another way to add Hierarchy Support of the attributes or do without it…

    Once again, sorry for your time…

    Thread Starter dino777

    (@dino777)

    Hi,

    I don’t use this hook and I didn’t change it’s value by myself… I made a search in my entire /www/ folder for the term “yith_wcan_include_terms” to find if anything else (like a plugin) would change it’s value, but the only results were in the yith plugin files:

    
    ..\wp-content\plugins\yith-woocommerce-ajax-navigation\includes\functions.yith-wcan.php:
      256          $exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
      257:         $include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
      258          $reordered = false;
    
      658      function yit_reorder_hierachical_categories( $parent_term_id, $taxonomy = 'product_cat' ) {
      659          $exclude = apply_filters( 'yith_wcan_exclude_terms', array(), array() );
      660:         $include = apply_filters( 'yith_wcan_include_terms', array(), array() );
    
      662          $childs = yith_wcan_wp_get_terms(
    
    ..\wp-content\plugins\yith-woocommerce-ajax-navigation\widgets\class.yith-wcan-navigation-widget.php:
      959                  $exclude    = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
      960:                 $include    = apply_filters( 'yith_wcan_include_terms', array(), $instance );
      961                  $echo       = false;
    

    Those are the original files of the plugin, I didn’t change any files for this plugin.

    I added the filter you given to me in my functions.php (the one from my child theme) and, unfortunately, it didn’t make any change ( but I don’t know how to check if this array is now empty).

    I let this filter in the file for now…

    Thank you for your help

    • This reply was modified 7 years, 7 months ago by dino777.
    Thread Starter dino777

    (@dino777)

    Hello,

    Sorry, I changed the ddns address to the real one on the server yesterday.

    But:
    After the last update of the Shop-Isle theme (2.2.1) that I made Yesterday, the problem was solve by itself. I just went to the demo website of the theme (here), where there was a similar problem 4 days ago, and there is no more bug there…

    I don’t know if the demo site was also update since. I know for sure that the problem was not from my browser (a client complain about it first, so I installed a Sierra VM to check, I saw the bug 4 days ago, and the VM has not been update since).

    So problem solve, for now…

    Thanks anyway!

    Thread Starter dino777

    (@dino777)

    Sorry, I had another problem with my webserver. Forget the ddns link, you can check it on the live server now: here

    The Ajax Filter is configured like:
    – Type : List
    – Query Type : AND
    – Attribute : region
    – Display : All (hierarchical)

    • This reply was modified 7 years, 7 months ago by dino777. Reason: add widget configuration
    Thread Starter dino777

    (@dino777)

    Hi,

    Thanks for your answer.

    I thought it was a plugin problem because it was working fine before the update of Woocommerce. But maybe there is another issue… I do not have a specific configuration, I just added the YIFI plugin and made a “list” filter on an existing attribute.

    The webserver is down for now, but you can access my local (test) server, if it’s running (18/24h), with my ddns link: here

    -> On the left, you have “FILTRER PAR RéGION”

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