Horizontal search URL don't take correct language

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Horizontal search URL don't take correct language

This topic contains 21 replies, has 2 voices, and was last updated by smartbrand smartbrand 3 years, 9 months ago.

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #28023
    smartbrand
    smartbrand
    Participant

    Hi,

    We have detected a problem.

    When we show search results in horizontal view, it doesn’t catch WPML language correctly. It takes the main language, and get his URLs incorrectly. It takes the URL of the main language, and not the current language one (https://prnt.sc/t4d1o7).

    We use the WPML plugin to work the languages, where the main language is Spanish and we have English and French as children.

    It’s possible ti disable this results at this moment?

    Can you help us to resolve this issue?

    Thanks in advance,

    #28026
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Looks like the wpml_permalink call is not resolving the URLs correctly. I looked up their documentation, and there seems to be a way to force that. This requires a bit of custom code, but should hopefully work.

    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_filter('asp_results', 'asp_full_resolve_wpml', 10, 4);
    function asp_full_resolve_wpml( $results, $id, $is_ajax, $args ) {
    	foreach ( $results as $k => &$r ) {
    		if ( isset($r->post_type) )
    			$r->link = apply_filters( 'wpml_permalink', get_permalink($r->id), $args['_wpml_lang'], true );
    	}           
    	return results;
    }

    Let me know if it works.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #28027
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    We tried adding this code in our theme function.php file, but not resolve the issue.

    Nothing change 🙂

    We add tis code in ‘/var/www/bh.fitness/htdocs/content/plugins/ajax-search-pro/includes/views/results/horizontal.php’:
    <?php if (!empty($r->post_type)) $r->link = get_post_permalink($r->id); ?>

    And resolve it. It’s correct?

    Thanks,

    #28034
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That is very interesting. If that works, you can of course use that as a solution. I will try to integrate one for the upcoming release if possible.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #28035
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    Ok, thanks.

    Yes you integrate if you can because is very easy and resolve this problem.

    Thanks

    #28045
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    We try today and happens again. The issue issn’t resolved.

    At the moment can we disable this 2 suggestions (https://prnt.sc/t4wlkq). The issue is only in this results and while you try to correct the error, we need to disable it.

    What more can we try?

    Thanks in advance,

    #28046
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #28054
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    I’m creating FTP acesses, but you say us how can we disable this 2 suggestions (https://prnt.sc/t4wlkq). The issue is only in this results and while you try to correct the error, we need to disable it.

    Thanks,

    #28055
    smartbrand
    smartbrand
    Participant
    You cannot access this content.
    #28074
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    You can exclude those results until then. I tried to connect with the details, but the server says that password authentication is denied. Can you please check?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #28075
    smartbrand
    smartbrand
    Participant
    You cannot access this content.
    #28081
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    We force to disable horizontal results.

    Please, can you help us tu resolve the issue?

    Thanks,

    #28084
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you, the FTP works now. However when I tried to access the back-end I’m getting the following error: https://i.imgur.com/OwxSF6g.png

    It looks like you have some sort of a DB cache active with W3TC. I very strongly recommend turning that off, that could very well cause this issue as well. I checked WPML API, everything related on how to correctly use it, but the code the plugin uses is perfectly correct. I’m afraid there might be something else causing the conflict as well.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #28085
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    Can you do it directly please, and i test i. I can’t disabled

    Thanks,

    #28086
    smartbrand
    smartbrand
    Participant

    Hi Ernest,

    We desactivate W3TC plugin to try it, but not resolve this issue.

    We don’t have any Cache.

    Can you help us?

    Thanks,

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic.