Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Seems to be on
    setcookie( ‘wpcf7_guest_user_id’, $guest_id, time() + 3600 * 12, ‘/’ );

    // Generate cookie
    function dnd_cf7_generate_cookie() {
        if ( ! isset( $_COOKIE['wpcf7_guest_user_id'] ) ) {
            $characters       = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
            $charactersLength = strlen( $characters );
            $randomString     = '';
    
            for ( $i = 0; $i < 12; $i++ ) {
                $randomString .= $characters[ random_int( 0, $charactersLength - 1 ) ] ;
            }
    
            $guest_id = $randomString .'-'. mt_rand(1000, 9999);
            setcookie( 'wpcf7_guest_user_id', $guest_id, time() + 3600 * 12, '/' );
        }
    }

    Solution, replace in

    /wp-content/plugins/yith-woocommerce-ajax-navigation/includes/widgets/class-yith-wcan-navigation-widget.php on line 651, 652

    This

            // All current filters.
    if ( $_chosen_attributes ) {
    foreach ( $_chosen_attributes as $name => $data ) {
    if ( $name !== $taxonomy ) {

    // Exclude query arg for current term archive term.
    while ( $in_array_function( $term->slug, $data['terms'] ) ) {
    $key = array_search( $current_term, $data ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
    if ( $key ) {
    unset( $data['terms'][ $key ] );
    }
    }

    // Remove pa_ and sanitize.
    $filter_name = urldecode( sanitize_title( str_replace( 'pa_', '', $name ) ) );

    if ( ! empty( $data['terms'] ) ) {
    $link = add_query_arg( 'filter_' . $filter_name, implode( apply_filters( "yith_wcan_{$display_type}_filter_operator", ',', $display_type, $query_type ), $data['terms'] ), $link );
    }

    if ( 'or' === $data['query_type'] ) {
    $link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
    }
    }
    }
    }

    With this

            // All current filters - Modificat Flavius - 10.11.2024
            if ( $_chosen_attributes ) {
                foreach ( $_chosen_attributes as $name => $data ) {
                    // Verificăm dacă nu suntem pe același taxonomie
                    if ( $name !== $taxonomy ) {
    
                        // Exclude query argument pentru termenul curent al arhivei
                        if ( isset( $data['terms'] ) && is_array( $data['terms'] ) ) {
                            foreach ( $data['terms'] as $key => $term_slug ) {
                                if ( $in_array_function( $term_slug, $data['terms'] ) ) {
                                    // Căutăm termenul curent în lista de termeni
                                    $key = array_search( $current_term, $data['terms'] ); // Verificăm dacă termenul există
                                    if ( $key !== false ) {
                                        // Eliminăm termenul găsit
                                        unset( $data['terms'][ $key ] );
                                    }
                                }
                            }
                        }
    
                        // Îndepărtăm prefixul 'pa_' și aplicăm sanitizare
                        $filter_name = urldecode( sanitize_title( str_replace( 'pa_', '', $name ) ) );
    
                        // Verificăm dacă termenii sunt disponibili
                        if ( ! empty( $data['terms'] ) ) {
                            // Adăugăm termenii ca parametru în URL
                            $link = add_query_arg( 'filter_' . $filter_name, implode( apply_filters( "yith_wcan_{$display_type}_filter_operator", ',', $display_type, $query_type ), $data['terms'] ), $link );
                        }
    
                        // Dacă query_type este 'or', îl adăugăm în link
                        if ( 'or' === $data['query_type'] ) {
                            $link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
                        }
                    }
                }
            }
Viewing 2 replies - 1 through 2 (of 2 total)