• Resolved piemu

    (@piemu)


    Hello,
    the filter is great it was just what I was looking for but unfortunately it doesn’t work.
    When I go to check the category or tag of my interest or redirected to a “busted” page and not to the product or category archive page.
    What can it depend on?
    Can you help me? Thank you

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Alessio Torrisi

    (@alessio91)

    Hi there,
    May I ask you provide me additional information about your issue? Any video will be much appreciated.
    I did a test but I was not able occur any issue.

    Thread Starter piemu

    (@piemu)

    Ciao Alessio,
    come da tua richiesta ecco il video.

    [video src="https://www.eluce.it/shop/wp-content/uploads/2022/10/ajax-product-filter-bug.mp4" /]

    Attendo tue grazie mille.
    Pietro

    Plugin Support Alessio Torrisi

    (@alessio91)

    Ciao Pietro,
    innanzitutto ci tengo a precisare che una volta applicato il filtro non dovresti vedere il dettaglio del prodotto nella parte di destra, ma dovresti poter ottenere lo stesso layout con la lista dei prodotti filtrata sulla base dei filtri applicati.

    Nel tuo caso il problema potrebbe derivare dal fatto che stai usando, come hai detto tu stesso, dei template differenti per le tue pagine archivio, quando invece la soluzione più giusta sarebbe quella di utilizzare lo stesso template per la pagina Shop, le pagine categorie e tag.

    Puoi provare ad aggiungere uno o entrambi questi codici al file functions.php del tema e vedere se il problema persiste.

    add_filter( 'yith_wcan_suppress_default_query_vars', '__return_false' );

    if( ! function_exists( 'yith_wcan_set_query_vars' ) ){
        function yith_wcan_set_query_vars(){
            if ( ! function_exists( 'YITH_WCAN_Query' ) ) {
                return;
            }
    
            $qo = get_queried_object();
            $query_vars = YITH_WCAN_Query()->get_query_vars();
    
            
            if ( is_product_taxonomy() && $qo instanceof WP_Term && ! isset( $query_vars[ $qo->taxonomy ] ) ) {
                YITH_WCAN_Query()->set( $qo->taxonomy, $qo->slug );
            } elseif ( is_page() && $qo instanceof WP_Post && ! isset( $query_vars['product_cat'] ) ) {
                $page_slug    = $qo->post_name;
                $related_term = get_term_by( 'slug', $page_slug, 'product_cat' );
                if ( $related_term && ! is_wp_error( $related_term ) ) {
                    YITH_WCAN_Query()->set( 'product_cat', $related_term->slug );
                }
            }
        }
        add_action( 'wp', 'yith_wcan_set_query_vars' );
    }
    Thread Starter piemu

    (@piemu)

    Ciao Alessio, ti ringrazio molto per l’assistenza.
    Ho risolto senza aggiungere il codice ma come hai ben detto il problema che riscontravo era dovuto al semplice fatto che avevo 3 template per ogni pagina di archivio.
    Grazie mille e buona serata.

    Plugin Support Alessio Torrisi

    (@alessio91)

    Buongiorno,
    sono felice di vedere che hai risolto il tuo problema.

    Laddove fossi soddisfatto del nostro prodotto e del nostro supporto, non esitare a lasciare il tuo feedback a questo link, ne saremmo molto felici 🙂

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

The topic ‘filter not working’ is closed to new replies.