Home › Forums › WoodMart support forum › Fatal error found
Fatal error found
- This topic has 13 replies, 4 voices, and was last updated 3 years, 5 months ago by Eric Watson.
-
AuthorPosts
-
June 22, 2021 at 7:37 am #301293
metuzaParticipantHello,
I did find this fatal error today, when i look at timing it could have happend with my latest order:
[22-Jun-2021 06:27:55 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_price_html() on bool in /wp-content/themes/woodmart/inc/modules/search.php:374
Stack trace:
#0 /wp-includes/class-wp-hook.php(292): woodmart_ajax_suggestions(”)
#1 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(”, Array)
#2 /wp-includes/plugin.php(484): WP_Hook->do_action(Array)
#3 /wp-admin/admin-ajax.php(202): do_action(‘wp_ajax_nopriv_…’)
#4 {main}
thrown in /wp-content/themes/woodmart/inc/modules/search.php on line 374But i have to mention that i was hacked through Relevanssi plugin this morning, they had filled search query with some dating site urls and lots of hearts. So fatal error could also be from this. We will see if it appear again.
Brgds
RuneJune 22, 2021 at 11:20 am #301372
Artem TemosKeymasterHello,
We have checked on our side and see no errors there. Let us know if the issue persists and you get new errors in your logs.
Kind Regards
June 23, 2021 at 8:59 am #301696
MikeParticipant@Artem Is it happend when you try to search a product on front, enable debug and try to search a product, then you will get the error outpout
June 23, 2021 at 9:35 am #301708
Artem TemosKeymasterHi @Mike,
Please, send us your admin and FTP access so we can check it. Also, specify which word do you use for the search.
Kind Regards
June 23, 2021 at 9:49 am #301712June 23, 2021 at 9:51 am #301713
Artem TemosKeymasterPlease, send us your admin and FTP access so we can check what is wrong.
June 23, 2021 at 9:57 am #301716
metuzaParticipantYes, when using numers or any other chars like – ‘, searching a SKU, ie. WI-ROK then error appear. But any normal search string with only alpha chars seems to work ok.
Just did another test, searching for 123 then it never stopped searching/rolling the icon.
Brgds
RuneJune 23, 2021 at 10:37 am #301732June 23, 2021 at 12:09 pm #301787
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to fix this
function woodmart_sku_search_query_new( $where, $s ) { global $wpdb; $search_ids = array(); $terms = explode( ',', $s ); foreach ( $terms as $term ) { //Include the search by id if admin area. if ( is_admin() && is_numeric( $term ) ) { $search_ids[] = $term; } // search for variations with a matching sku and return the parent. $sku_to_parent_id = $wpdb->get_col( $wpdb->prepare( "SELECT p.post_parent as post_id FROM {$wpdb->posts} as p join {$wpdb->wc_product_meta_lookup} ml on p.ID = ml.product_id and ml.sku LIKE '%%%s%%' where p.post_parent <> 0 group by p.post_parent", wc_clean( $term ) ) ); //Search for a regular product that matches the sku. $clean_term = wc_clean( $term ); $sku_to_id = $wpdb->get_results( "SELECT product_id FROM {$wpdb->wc_product_meta_lookup} WHERE sku LIKE '%{$clean_term}%';", ARRAY_N ); $sku_to_id_results = array(); if ( is_array( $sku_to_id ) ) { foreach ( $sku_to_id as $id ) { $sku_to_id_results[] = $id[0]; } } $search_ids = array_merge( $search_ids, $sku_to_id_results, $sku_to_parent_id ); } $search_ids = array_filter( array_map( 'absint', $search_ids ) ); if ( sizeof( $search_ids ) > 0 ) { $where = str_replace( ')))', ")) OR ( {$wpdb->posts}.ID IN (" . implode( ',', $search_ids ) . ")))", $where ); } return $where; }
June 23, 2021 at 12:15 pm #301792
metuzaParticipantYes, that seems to work for both numbers or other chars. I belive this will be included in the next update also?
Brgds
RuneJune 23, 2021 at 12:38 pm #301805June 23, 2021 at 12:48 pm #301812
Artem TemosKeymasterYes, it will be fixed in our 6.1.1 that will be released now.
June 23, 2021 at 12:58 pm #301821June 23, 2021 at 2:31 pm #301881
Eric WatsonParticipantYou are welcome! If you have any questions please feel free to contact us.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register