This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Error 500 with AjaxSearchPro Plugin

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Error 500 with AjaxSearchPro Plugin

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #52779
    aliciaalicia
    Participant

    Dear AjaxSearchPro Support Team,

    I am experiencing an issue with the AjaxSearchPro plugin on my website. When performing any search using the search bar created with this plugin, I encounter the following error message:

    “The request failed. Please check your connection! Status: 500.”

    This issue occurs consistently every time I attempt a search.

    Could you please assist me in resolving this error? I would appreciate any guidance or troubleshooting steps you can provide.

    Thank you for your time and support.

    Best regards,
    Alícia

    • This topic was modified 1 year, 3 months ago by alicia.
    • This topic was modified 1 year, 3 months ago by alicia.
    • This topic was modified 1 year, 3 months ago by alicia.
    #52788
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi Alícia,

    Thank you very much for the details, it helps a lot!

    I tried to log-in to check the settings, but the username or password is incorrect. Can you please check that?
    It’s probably something in the configuration, I will verify that for you.

    #52792
    aliciaalicia
    Participant

    You cannot access this content.

    #52793
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Thank you Alícia, my mistake!

    The settings seem to be all right. Do you use any customizations, custom codes or anything related to Ajax Search Pro by any chance? I’m asking because even empty requests return an error, which usually happens when there is an issue with a customization.

    If not, then can you please add temporary SFTP details? I will have to debug through the search process to see where it fails, there is probably an error message which will lead to the solution.

    #52833
    aliciaalicia
    Participant

    You cannot access this content.

    #52834
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi Alícia,

    Does the issue go away if the customization is removed?

    #52844
    aliciaalicia
    Participant

    Hi Ernest,

    I’ve already tried removing the customization, but the issue persists and the error is still appearing.

    Please let me know the next steps to resolve this.

    Thank you for your continued support.

    Best regards,
    Alícia

    #52845
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Thank you!

    Can you please add temporary SFTP details? I will have to debug through the search process to see where it fails, there is probably an error message which will lead to the solution.

    #52860
    aliciaalicia
    Participant

    You cannot access this content.

    #52885
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Thanks!

    The issue is caused by the custom code as it uses the “yoast_get_primary_term_id” function, but the Yoast SEO plugin is disabled, so that no longer exists. I made a modification to it to check if the function exists first:

    add_filter(
        'asp_results',
        function ( $results, $id, $is_ajax, $args ) {
            foreach ( $results as $r ) {
    			if ( function_exists('yoast_get_primary_term_id') ) {
    				// Intenta obtenir la categoria principal amb Yoast
    				$main_term_id = yoast_get_primary_term_id( 'category', $r->id );
    			} else {
    				$main_term_id = false;
    			}
                
                
                
                // Si no hi ha categoria principal, obtenim la primera categoria disponible
                if ( empty($main_term_id) ) {
                    $terms = get_the_terms( $r->id, 'category' );
                    if ( !empty($terms) && !is_wp_error($terms) ) {
                        // Prenem la primera categoria disponible
                        $term = reset($terms);
                    } else {
                        continue;
                    }
                } else {
                    // Si hi ha categoria principal, la utilitzem
                    $term = get_term( $main_term_id );
                    if ( empty($term) ) {
                        continue;
                    }
                }
    
                // Afegeix la categoria als resultats
                $r->content = 
                    '<div class="result-cat-container"><span class="result-cat">'.$term->name.'</span></div>' . $r->content;
            }
            return $results;
        },
        10,
        4
    );
    #52889
    aliciaalicia
    Participant

    Hi Ernest,

    Thank you so much for your help and for identifying the issue.

    I must apologize – it seems I didn’t test thoroughly before. Had I commented out the code, I would have noticed that the search was working fine. I appreciate your patience and the fix you made to the code.

    Thank you again for your prompt support and for resolving the issue!

    Best regards,
    Alícia

    #52890
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You are very welcome Alícia 🙂 No worries!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.