Support » Plugin: YITH WooCommerce Ajax Product Filter » product_cat-sitemap not working after installation of this plugin

  • Resolved Raunak Gupta

    (@raunak01)


    Hi,

    Recently I noticed that because of YITH WooCommerce Ajax Product Filter, All In One SEO Pack Product Category sitemap has stop working.

    I am getting below error on example.com/product_cat-sitemap.xml page

    <b>Fatal error</b>: Allowed memory size of 268435456 bytes exhausted (tried to allocate 28672 bytes) in <b>/wp-includes/wp-db.php</b> on line <b>2550</b><br />

    <b>Fatal error</b>: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in <b>/wp-content/plugins/woocommerce/includes/class-wc-log-levels.php</b> on line <b>1</b><br />

    I have uninstall all the plugin except

    1. All In One SEO Pack (v3.1.1)
    2. WooCommerce (v3.6.4)
    3. YITH WooCommerce Ajax Product Filter (v3.6.6)

    and switch to Twenty Nineteen theme and the issue is still there. As soon as I am deactivating YITH WooCommerce Ajax Product Filter everything is working as expected.

    WordPress version in 5.2.2

    Can you please help me as to why this is happening. If you need any more inside then please let me know.

    Thank you.
    Raunak Gupta.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes, I am also facing the same issue and just notice if I disable “Ajax Product Filter” plugin everything seems to be working as required.

    I think when this plugin see product_cat in the URL it try to make some kind of heavy query in backend which causes this Fatal error.

    @raunak101 did you find any work around for it ?

    If so then please help me also.

    I think YITH needs to check this asap.

    Thanks in advance.

    Hi @ranaghosh, No I haven’t got the work around but got the exact area which is causing the error.

    If you look into the below image you will get the idea.

    2019-06-27-2314

    /wp-content/plugins/yith-woocommerce-ajax-navigation/includes/class.yith-wcan-frontend.php line number 203 is causing the error

    If I replace this line

    $this->unfiltered_product_ids = apply_filters( 'yith_wcan_unfiltered_product_ids', get_posts( $unfiltered_args ), $query, $current_wp_query );

    by this

    $this->unfiltered_product_ids = [];

    Then everything start working, but I don’t what effect will this in UI filtration of product.

    • This reply was modified 4 months, 3 weeks ago by Raunak Gupta.
    Plugin Author YITHEMES

    (@yithemes)

    Hi,
    and thank you for writing in and for reporting that!

    We’ll take a look into it to fix this issue directly in the plugin.
    In the meantime, please try adding the following code snippet to your theme functions.php

    if ( !function_exists( 'yith_wcan_customization_all_in_one_seo_fix' ) ) {
        add_filter( 'init', 'yith_wcan_customization_all_in_one_seo_fix' );
        function yith_wcan_customization_all_in_one_seo_fix() {
            $uri            = !empty( $_SERVER[ 'REQUEST_URI' ] ) ? $_SERVER[ 'REQUEST_URI' ] : false;
            $is_dynamix_xml = $uri && preg_match( '/(sitemap\.xml)$/', $uri );
            if ( function_exists( 'YITH_WCAN' ) && $is_dynamix_xml ) {
                $yith_wcan = YITH_WCAN();
                if ( !empty( $yith_wcan->frontend ) ) {
                    remove_filter( 'the_posts', array( $yith_wcan->frontend, 'the_posts' ), 15 );
                }
            }
        }
    }

    This should solve the issue.

    Please try this solution and let us know if everything works fine!

    Hi,

    Thanks @yithemes, for looking into this issue.

    Yes, this code has fixed the issue.

    Thank you. 🙂

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,

    sounds good. We are happy that your website works fine now.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.