ResolvedPHP Fatal error: Uncaught Error: Call to a member function get_id() on null in
- This topic has 12 replies, 3 voices, and was last updated 3 years, 4 months ago by
Alex.
- AuthorPosts
- January 8, 2020 at 12:08 pm #20630
andy
ParticipantI created a simple product. When I click on Order Now in product search or wherever I get this error:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function get_id() on null in /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-content/themes/lafka/woocommerce/content-single-product-lafka-quickview.php:65\nStack trace:\n#0 /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-content/plugins/woocommerce/includes/wc-core-functions.php(249): include()\n#1 /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-content/themes/lafka/incl/woocommerce-functions.php(787): wc_get_template('content-single-...')\n#2 /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-includes/class-wp-hook.php(288): lafka_quickview('')\n#3 /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array)\n#4 /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-includes/plugin.php(478): WP_Hook->do_action(Array)\n#5 /var/www/vhosts/dev.interpid.eu/spizzati.dev.interpid.eu/wp-admin/admin-ajax.php(175): do_action('wp_ajax_lafka_q....\n', referer: http://spizzati.dev.interpid.eu/product-category/speisen/dessert/
January 8, 2020 at 3:32 pm #20633Althemist
KeymasterHello andy,
Please, give us a link to your site, where we can see th problem “live”, so we can further investigate this for you.
Regards,
DimitarJanuary 9, 2020 at 1:22 pm #20650andy
ParticipantThis reply has been marked as private.January 9, 2020 at 1:22 pm #20651andy
ParticipantThis reply has been marked as private.January 13, 2020 at 2:32 pm #20673Althemist
KeymasterHello andy,
So sorry for the late reply. We had some internal problems here.
We have just checked your site and the problem is that your product doesn’t have an image. The quick view is looking for it and thus generates an error. Could you, please check if everything is OK when you attach a product image?
Regards,
DimitarJanuary 13, 2020 at 4:49 pm #20708andy
ParticipantYes, if there is an image it works well. Is there a quick workaround to solve this? We use a “default” image for all products that don’t have specified an image, as we don’t attach images to all products.
January 15, 2020 at 5:07 pm #20727Althemist
KeymasterYou’d need to manually assign a default image to those products. The one I saw on your website is just a placeholder. It’s not really assigned to the product and that’s the reason for the error.
Regards,
DimitarJanuary 16, 2020 at 6:44 pm #20751andy
ParticipantI understand the issue but your solution is not good.
It’s about a FATAL Error which is coming from the code from the theme, so it should be fixed in the theme.
We will use the placeholder for images, we don’t have images for all our products.Please provide a technical workaround/solution.
January 17, 2020 at 1:02 pm #20755andy
Participantjust use $product instead of $post and the problem is solved. $post on this page is probably a bug.
Very, very low quality support on this one.January 17, 2020 at 1:02 pm #20756andy
Participantecho apply_filters(‘woocommerce_single_product_image_html’, sprintf(‘
‘, wc_placeholder_img_src(), esc_html__(‘Placeholder’, ‘lafka’)), $product->get_id());
January 20, 2020 at 3:05 pm #20775Althemist
KeymasterHello andy,
I am really sorry about your disappointment and frustration. I’ll ask our lead developer Alex to step in and explain.
Meanwhile, we have a plan to introduce additional products layout, where users would be able to list products without any image (be it placeholder or not) – just as a list.
Regards,
DimitarJanuary 20, 2020 at 8:16 pm #20790Alex
KeymasterHello andy,
I am looking on the issue, will let you know for the outcome soon.
Regards,
AlexJanuary 21, 2020 at 11:18 am #20794Alex
KeymasterHello andy,
Thanks for your patience and for reporting the bug.
You are absolutely right, somehow we’ve left this ‘$post’ on the wrong place. Changing it to $product fixes the bug.
It is fixed now in the codebase.
We will release the update today.
Regards,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.