Visual Composer Integration

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Visual Composer Integration

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #11331
    mcatarino
    mcatarino
    Participant

    Hello,

    We need to know more information about “Redirect to URL” option.

    We have a page with Visual Composer and a Post Masonry Grid with Custom Query. If we set the custom query to “s=earth” it will work great with the search.

    We want a way to use search Redirect to URL to pass the s={phrase} to Visual Composer Custom Query.

    Is this possible? We are really in a hurry to deliver this Friday!

    Thanks a lot,
    Marco Catarino

    #11332
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Well, it depends on what query parameters does the custom query require. You might have to ask the developer, if there is a way to pass an argument.
    Then all you need to do is include the additional GET parameters in the redirect url field, and it should work.

    Best,
    Ernest Marcinko

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


    #11333
    mcatarino
    mcatarino
    Participant

    Hello,

    Actually what we need to know is if you guys know a way to pass querystring values to custom query in visual composer.

    Thanks,
    Marco Catarino

    #11335
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Marco,

    I’ve looked up the visual composer source regarding the post grid, but I haven’t found any way of doing it without modifying the composer plugin code. The query arguments are hard-coded, it does not let you add anything to it via query string. I was hoping that there might a filter available for the final grid arguments, but there isn’t. Without custom coding, this does not seem to be possible. Although I recommend asking the VC support as well.

    Best,
    Ernest Marcinko

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


    #11339
    mcatarino
    mcatarino
    Participant

    Hello,

    Can you please then tell me how can we change search results page to display visual composer elements based on a template? We bought your plugin thinking it would output a search result in a results page custumizable by visual composer.

    Thanks a lot,
    Marco Catarino

    #11341
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I have looked into it more, I might have found a possible solution, but it might not work as expected. The fact that the post grid gets the items via ajax, makes this far more complicated.
    Please keep in mind that this is far beyond regular support, so I cannot guarantee it’s going to work.

    First, open up the \wp-content\plugins\js_composer\include\classes\shortcodes\vc-basic-grid.php file and scroll to line 485, which should be this:

    $query = html_entity_decode( vc_value_from_safe( $this->atts['custom_query'] ), ENT_QUOTES, 'utf-8' );

    ..just below that line, put this:

    $pu = parse_url($_SERVER["HTTP_REFERER"]);
    if ( isset($pu['query']) ) {
      parse_str($pu['query'], $ags);
      if ( isset($ags['qs']) )
        $query = 's='.$ags['qs'];
    }

    This will attempt to parse the referrer url, and if the “qs” query argument is set, then will try to parse it, and pass it to the grid. You can change this to anything, I have choosen “qs” as it will not redirect to the search page automatically.

    Then on the ajax search pro General Options -> Behavior panel, change the Redirect to url option to the page where the grid is created and the qs argument. In my case it was page 99, so it became:

    ?p=99&qs={phrase}

    Now the search redirects to this page, and the visual composer detects the “qs” argument, and changes the $query variable accordingly.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.