is_page() error in class-wpsolr-plugin-woocommerce.php resulting in null-object

  • leomoon
    Participant
    5 years ago #10832

    There are several errors of this content that appear on the storefront/bookshop theme homepage ONLY:

    ( ! ) Notice: Trying to get property ‘ID’ of non-object in /var/www/antikvarijatknjiga.hr/public_html/wp-includes/class-wp-query.php on line 3918

    You can full the full stack trace if you simply go to http://www.antikvarijatknjiga.hr

    wpsolr
    Keymaster
    5 years ago #10846

    It crashes on is_shop().

    Do you have a shop page?

    leomoon
    Participant
    5 years ago #10848

    The shop page indeed was not defined, but I got the woocommerce to make all the pages again, and the shop page now is defined (a default one, https://www.antikvarijatknjiga.hr/shop/), BUT, the errors are still there.

    The is_shop() function returns false.

    wpsolr
    Keymaster
    5 years ago #10849

    Can you check that it is the exact same error?

    leomoon
    Participant
    5 years ago #10850

    Not exactly the same, but now it fails at is_page(). Here are few last lines of the stack trace. If you go to http://www.antikvarijatknjiga.hr you can see the full trace.

    wpsolr\pro\extensions\woocommerce\WPSOLR_Plugin_WooCommerce->is_product_category_url( )
    …/class-wpsolr-plugin-woocommerce.php:357
    is_shop( )
    …/class-wpsolr-plugin-woocommerce.php:383
    …/wc-conditional-functions.php:32
    WP_Query->is_page( )

    wpsolr
    Keymaster
    5 years ago #10851

    Did you activate the replace archive ‘Home page’ in WPSOLR screen 2.1?

    leomoon
    Participant
    5 years ago #10852

    I just did, yet it sill has the same problem. I activated replace on search, home/blog, categories and tags. Exact the same errors.

    leomoon
    Participant
    5 years ago #10853

    Apparently, in class-wp-query.php, line 3914:

    $page_obj = $this->get_queried_object();

    returns null even though it passes is_page() logic, and the id is correct (the shop page ID).

    wpsolr
    Keymaster
    5 years ago #10854

    So, you had the issue even without the “replace archive home page” option?

    leomoon
    Participant
    5 years ago #10855

    Yes, the same issue.

    I added check for null return to class-wp-query.php:

    $page_obj = $this->get_queried_object();

    if($page_obj == null)
    {
    return false;
    }

    But this is a temporary fix. Something is wrong.

    leomoon
    Participant
    5 years ago #10856

    But here is a screenshot of the stack trace before that fix, just so you have it for reference:

    https://1drv.ms/u/s!Ah6mDhPS2VbWhuxytFoF19oJgTXQjw

    wpsolr
    Keymaster
    5 years ago #10857

    I’m trying to replicate this issue.

    Your home page is a products archive?

    leomoon
    Participant
    5 years ago #10858

    It actually is not directly a product archive. It is a page based on Homepage template that is part of Storefront Powerpack.

    Here is storefont theme:
    https://1drv.ms/u/s!Ah6mDhPS2VbWhuxzDU3NCCmEGzs8vQ

    Here is storefront Powerpack:
    https://1drv.ms/u/s!Ah6mDhPS2VbWguMAAHMZqky9NpbWTw

    Here is bookshop child theme I am using:
    https://1drv.ms/u/s!Ah6mDhPS2VbWguMO5ICfdXwrWSPIVA

    wpsolr
    Keymaster
    5 years ago #10859

    Thanks. I donwloaded the files.

    By the way, do you receive your topic’s reply alerts now?

    leomoon
    Participant
    5 years ago #10860

    Great, I can remove the shares then.

    Yes, I get the notifications now!

Viewing 15 posts - 1 through 15 (of 53 total)

You must be logged in to reply to this topic.