• Resolved optimalprime

    (@optimalprime)


    Hello I want to use your product search to replace my current one as it doesnt search deep enough. Thing is a long time ago I added some code in the functions.php to have the position of the search box in the upper right. So i guess I have to add your shortcode here? But I am a bit struggling how to make that work

    this is my current search bar setup.

    So does this has to be altered into Advance woo search for it to make it work by adding echo do_shortcode( '[aws_search_form]' ); in it?

    Hope someone can help me. Thank you in advance.

    //* POSITION THE PRODUCT SEARCH BUTTON TO UPPER RIGHT *//

    add_filter( 'wp_nav_menu_items', 'wpstudio_add_woo_search', 10, 2 );

    function wpstudio_add_woo_search( $menu, $args ) {

    //* Change 'primary' to 'secondary' to add the woocommerce search to the secondary navigation menu
    if ( 'secondary' !== $args->theme_location )
    return $menu;

    $form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '">
    <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Search for products', 'woocommerce' ) . '" />
    <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search', 'woocommerce' ) .'" />
    <input type="hidden" name="post_type" value="product" />
    </form>';

    $menu .= '<li class="search right">' . $form . '</li>';

    return $menu;

    }
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Please try to replace your current code with this one:

    add_filter( 'wp_nav_menu_items', 'wpstudio_add_woo_search', 10, 2 );

    function wpstudio_add_woo_search( $menu, $args ) {

    //* Change 'primary' to 'secondary' to add the woocommerce search to the secondary navigation menu
    if ( 'secondary' !== $args->theme_location )
    return $menu;

    $form = do_shortcode( '[aws_search_form]' );

    $menu .= '<li class="search right">' . $form . '</li>';

    return $menu;

    }

    Regards

    Thread Starter optimalprime

    (@optimalprime)

    Hello, was a bit out. But this did the trick so thank you. Only I have one little problem still, which I dont understand.

    On mobile devices I noticed than when I type in a product it will generate the ajax results. If I click on that it will go to that product page, but if I choose to type in the product and then the search icon, either in the search bar on the website or the search icon in your mobile device keyboard it will give only image results (which are named as the product). It will straight go to a search result page:

    “Search Results for: … ”

    …with only the images called that way as the results, so i think those are results for the native wordpress search somehow instead of activating your plugins results trigger. Do you have any idea why and how this can happen?

    • This reply was modified 1 year, 6 months ago by optimalprime.
    Thread Starter optimalprime

    (@optimalprime)

    I am sorry, it seemed to also trigger when I click on “view all results” within the ajax suggestion, then it also goes to a result page with only images that have that name, so not the productpage it gives as the suggestion within the ajax result. I dont see an option to turn off within your plugin for image description names, but to me it looks like the native WordPress result page that gets triggered. Only on mobile devices (phone and tabled this happens). Desktop is fine.

    • This reply was modified 1 year, 6 months ago by optimalprime.
    • This reply was modified 1 year, 6 months ago by optimalprime.
    Thread Starter optimalprime

    (@optimalprime)

    Ok I figured it out what it was and I will share it here, so maybe someone else can benefit from it if they have the same problem or you can mention it somewhere. The reason why it would give image results on mobile devices was a ticked option in the Yoast plugin:

    Settings > Advanced > Crawl optimalisation > Advanced: URL cleanup > Remove unregistered URL parameters

    That option was activated with me, after deactivation it functions correctly.

    Thank you for the previous help and Hope this might help someone else in the future. This is resolved

    Plugin Author ILLID

    (@mihail-barinov)

    Thanks for this detailed explanation. I will add a fix for this to the next plugin version.

    Regards

    Thread Starter optimalprime

    (@optimalprime)

    Its the least I can do. Thank you for making it possible to use your plugin. Its people like you who enrich the digital world. Regards

    Plugin Author ILLID

    (@mihail-barinov)

    Thanks for your kind words and have a great day!

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

The topic ‘Seamless integration doesnt work for me’ is closed to new replies.