result page

This topic contains 6 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #39466
    YUANFAN
    YUANFAN
    Participant

    How to make the result page appear in the iframe instead of jumping?
    I can’t find the code location.

    • This topic was modified 1 year, 6 months ago by YUANFAN YUANFAN.
    #39479
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I am not sure if this is possible at all. The form had to be submitted to the iframe, but the iframe source also has to be the original page.
    I don’t think this is easily possible without maybe editing the core plugin files.

    Best,
    Ernest Marcinko

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


    #39489
    YUANFAN
    YUANFAN
    Participant

    I uploaded a picture
    My iframe is just below the search and I want the result page to appear in the iframe

    The settings of the plugin Results Behaviour cannot be implemented, there is only an option to open a new window.

    Because I’m not good at coding and don’t know where to start.

    Attachments:
    You must be logged in to view attached files.
    #39512
    YUANFAN
    YUANFAN
    Participant

    How to code the way to open the jump result page?
    I don’t see _blank, where else can I modify it?

    #39513
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Please note that custom coding is not actually part of our support. I will try to answer your questions, but I can’t promise anything regarding custom code.

    The redirection to the results page (when assigned to a new window) is handled by a function. Maybe if you try to override that, it may actually work:

    add_action('wp_footer', 'asp_add_footer_script_2', 9999);
    function asp_add_footer_script_2() {
    	?>
    	<script>
    	(function($){
    		WPD.ajaxsearchpro.helpers.openInNewTab = function(url) {
                      Object.assign(document.createElement('a'), { target: 'iframe1', href: url}).click();
                    }
    	}(WPD.dom))
    	</script>
    	<?php
    }

    For this you also have to change the redirection to a new tab: https://i.imgur.com/KrUwaGP.png

    However this may not work at all.

    Best,
    Ernest Marcinko

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


    #42156
    YUANFAN
    YUANFAN
    Participant

    Your code solved my problem. But after I updated ajax search pro version 4.26.2, the code became invalid. What causes it?

    #42164
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Check if your frame name has not been changed, in the code it’s “iframe1”. There was no change in the scripts for the most recent releases, so this should still work just fine.

    Also, you can try a different variation:

    add_action('wp_footer', 'asp_add_footer_script_2', 9999);
    function asp_add_footer_script_2() {
    	?>
    	<script>
    setTimeout(function(){
    		WPD.ajaxsearchpro.helpers.openInNewTab = function(url) {
                      Object.assign(document.createElement('a'), { target: 'iframe1', href: url}).click();
                    }
    }, 2000);
    	</script>
    	<?php
    }
    Best,
    Ernest Marcinko

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


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

The topic ‘result page’ is closed to new replies.