• Resolved LoreGI13

    (@loregi13)


    Hi there,

    if anyone can share a suggestion to fix my php errors, because I’m not so skilled to to it, if it is not too complicated I’m asking for support!
    In fact, `in my functions.php file I am advised about 2 php errors which are repeated in my category pages, in detail:

    ERROR 1:

    The query monitor message is:

    “ Trying to access array offset on value of type bool “

    the Locations where the error is found is in functions.php… I copy/past location message:

    wp-content/themes/astra-child/functions.php:199
    . get_product_category_by_id()?wp-content/themes/astra-child/woocommerce/archive-product.php:171
    . wc_get_template()?wp-content/plugins/woocommerce/templates/taxonomy-product-cat.php:22
    . ?

    if I go to the line 199 in my functions.php I find the code :

    return $term[‘slug’];

    which I imagine contains that error

    … I write the same code in its context:

    function get_product_category_by_id( $category_id ) {
    $term = get_term_by( ‘id’, $category_id, ‘product_cat’, ‘ARRAY_A’ );
    return $term[‘slug’];
    }

    any idea of what’s wrong in:

    return $term[‘slug’];

    ?

    ERROR 2

    The query monitor message is:

    “Undefined variable: product_id”

    the location is again functions.php on line 84:

    I copy the location message:

    wp-content/themes/astra-child/functions.php:84
    wc_template_loop_product_replaced_thumb()
    wp-includes/class-wp-hook.php:303
    do_action(‘woocommerce_before_shop_loop_item_title’)
    wp-content/themes/astra-child/woocommerce/archivedlava-product.php:42
    load_template(‘wp-content/themes/astra-child/woocommerce/archivedlava-product.php’)
    wp-content/plugins/woocommerce/includes/wc-core-functions.php:284
    wc_get_template_part()
    wp-content/themes/astra-child/woocommerce/archive-product.php:176
    wc_get_template()
    wp-content/plugins/woocommerce/templates/taxonomy-product-cat.php:22

    if I go to functions.php on line 84 I find:

    $img2 = get_field(‘dlava_orizzontal_frame’, $product_id);`

    I guess I should add something in $product_id… isn’t it?

    If anyone can help I’m really grateful.

    Many thanks,
    Lorenza

Viewing 1 replies (of 1 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    You’ll be better off asking on the Astra forum or the general theme forum, as this forum is for questions and issues with the Query Monitor plugin itself, not for problems that it identifies with your website.

    Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘PHP Errors/Notices’ is closed to new replies.