Home Forums WoodMart support forum Fatal error found

Fatal error found

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #301293

    metuza
    Participant

    Hello,

    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 374

    But 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
    Rune

    #301372

    Artem Temos
    Keymaster

    Hello,

    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

    #301696

    Mike
    Participant

    @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

    #301708

    Artem Temos
    Keymaster

    Hi @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

    #301712

    Mike
    Participant

    @Artem is it happend with numbers and letters

    #301713

    Artem Temos
    Keymaster

    Please, send us your admin and FTP access so we can check what is wrong.

    #301716

    metuza
    Participant

    Yes, 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
    Rune

    #301732

    Mike
    Participant

    @artem check private

    #301787

    Artem Temos
    Keymaster

    Try 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;
    }
    #301792

    metuza
    Participant

    Yes, that seems to work for both numbers or other chars. I belive this will be included in the next update also?

    Brgds
    Rune

    #301805

    Mike
    Participant

    @Artem so it is a bug on theme? should we remove this after the next update right?

    #301812

    Artem Temos
    Keymaster

    Yes, it will be fixed in our 6.1.1 that will be released now.

    #301821

    Mike
    Participant

    @Artem great my brothaaa thank you! 😉

    #301881

    Eric Watson
    Participant

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

Viewing 14 posts - 1 through 14 (of 14 total)