double stats on user searches
-
Hey,
I appear to have double the stats shown in the # column for user searches?
I reset the log and search something fresh only once and it shows 2 in # column for that search query?
Is this a known issue with an easy fix? ??
Thanks ????
The page I need help with: [log in to see the link]
-
Oh I only have products selected in the indexing settings tab also because I thought it might be finding in multiple places but obviously not with only products ticked.
The search query I was testing on was ‘wind’ you should get 2 camping stoves show. Windmaster and windburner
If each query is logged twice, that means they’re like done twice. Does your search results template perhaps run a new query? That would explain this. Can you please show me what’s in the search results template of your theme?
This is the code in search.php
<?php elseif (rehub_option('search_layout') == 'columngrid' || rehub_option('search_layout') == 'columngridfull') : ?> <?php include(rh_locate_template('inc/parts/column_grid.php')); ?> <?php elseif (rehub_option('search_layout') == 'cardblog' || rehub_option('search_layout') == 'cardblogfull') : ?> <?php include(rh_locate_template('inc/parts/color_grid.php')); ?> <?php elseif (rehub_option('search_layout') == 'compactgrid' || rehub_option('search_layout') == 'compactgridfull') : ?> <?php $gridtype = 'compact'; include(rh_locate_template('inc/parts/compact_grid.php')); ?> <?php elseif (rehub_option('search_layout') == 'dealgrid' || rehub_option('search_layout') == 'dealgridfull') : ?> <?php include(rh_locate_template('inc/parts/compact_grid.php')); ?> <?php else : ?> <?php include(rh_locate_template('inc/parts/query_type1.php')); ?> <?php endif ;?> <?php endwhile; ?> <?php rehub_pagination(); ?> <?php else : ?> <div class="no-results not-found"> <h5><?php esc_html_e('Sorry. No posts in this category yet', 'rehub-theme'); ?></h5> </div> <?php endif; ?> </div> <div class="clearfix"></div> </div> <!-- /Main Side --> <?php if (rehub_option('search_layout') == 'gridfull' || rehub_option('search_layout') == 'dealgridfull' || rehub_option('search_layout') == 'compactgridfull' || rehub_option('search_layout') == 'columngridfull' || rehub_option('search_layout') == 'cardblogfull' ) : ?> <!-- Sidebar --> <?php else:?> <?php get_sidebar(); ?> <!-- /Sidebar --> <?php endif ;?> </div> </div> <!-- /CONTENT --> <!-- FOOTER --> <?php get_footer(); ?>
And this is in searchform.php
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <?php $search_text = (rehub_option("rehub_search_text")) ? rehub_option("rehub_search_text") : esc_html__("Search", "rehub-theme"); ?> <?php $posttypes = rehub_option("rehub_search_ptypes");?> <?php $posttype = (!empty($posttypes) && is_array($posttypes)) ? implode(',', $posttypes) : 'post'; ?> <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> <input type="text" name="s" placeholder="<?php echo esc_attr($search_text) ;?>" <?php if (rehub_option('rehub_ajax_search') == '1') {echo 'class="re-ajax-search" autocomplete="off"';} ?> data-posttype="<?php echo ''.$posttype;?>"> <?php if(rehub_option('rehub_search_ptypes') !='') {echo '<input type="hidden" name="post_type" value="'.$posttype.'" />';}?> <button type="submit" class="btnsearch"><i class="fal fa-search"></i></button> </form> <?php if (rehub_option('rehub_ajax_search') == '1') {echo '<div class="re-aj-search-wrap"></div>';} ?>
Is this what you meant Mikko? Thanks so much for your help!
That’s not the complete search.php, right? Anything else before that?
oh Mikko apologies. Not sure what happened there.
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <?php get_header(); ?> <?php $price_meta = rehub_option('price_meta_grid'); $disable_btn = (rehub_option('rehub_enable_btn_recash') == 1) ? 0 : 1; $disable_act = (rehub_option('disable_grid_actions') == 1) ? 1 : 0; $aff_link = (rehub_option('disable_inner_links') == 1) ? 1 : 0; ?> <!-- CONTENT --> <div class="rh-container"> <div class="rh-content-wrap clearfix"> <!-- Main Side --> <div class="main-side clearfix<?php if (rehub_option('search_layout') == 'gridfull' || rehub_option('search_layout') == 'dealgridfull' || rehub_option('search_layout') == 'compactgridfull' || rehub_option('search_layout') == 'columngridfull' || rehub_option('search_layout') == 'cardblogfull') : ?> full_width<?php endif ;?>"> <?php $cursearch = get_search_query();?> <div class="wpsm-title middle-size-title wpsm-cat-title"><h5><span><?php esc_html_e('Search results for:', 'rehub-theme'); ?></span> <?php echo esc_html($cursearch); ?></h5></div> <?php if (rehub_option('search_layout') == 'blog') : ?> <div class=""> <?php elseif (rehub_option('search_layout') == 'newslist') : ?> <div class=""> <?php elseif (rehub_option('search_layout') == 'communitylist') : ?> <div class=""> <?php elseif (rehub_option('search_layout') == 'deallist') : ?> <div class="woo_offer_list " > <?php elseif (rehub_option('search_layout') == 'grid') : ?> <?php wp_enqueue_script('masonry'); wp_enqueue_script('imagesloaded'); wp_enqueue_script('masonry_init'); ?> <div class="masonry_grid_fullwidth col_wrap_two"> <?php elseif (rehub_option('search_layout') == 'gridfull') : ?> <?php wp_enqueue_script('masonry'); wp_enqueue_script('imagesloaded'); wp_enqueue_script('masonry_init'); ?> <div class="masonry_grid_fullwidth col_wrap_three"> <?php elseif (rehub_option('search_layout') == 'columngrid') : ?> <div class="columned_grid_module rh-flex-eq-height col_wrap_three" > <?php elseif (rehub_option('search_layout') == 'columngridfull') : ?> <div class="columned_grid_module rh-flex-eq-height col_wrap_fourth"> <?php elseif (rehub_option('search_layout') == 'compactgrid') : ?> <div class="eq_grid post_eq_grid rh-flex-eq-height <?php echo (rehub_option('width_layout') =='extended') ? 'col_wrap_fifth' : 'col_wrap_fourth';?>"> <?php elseif (rehub_option('search_layout') == 'cardblog') : ?> <div class="coloredgrid rh-flex-eq-height <?php echo (rehub_option('width_layout') =='extended') ? 'col_wrap_fourth' : 'col_wrap_three';?>"> <?php elseif (rehub_option('search_layout') == 'cardblogfull') : ?> <div class="coloredgrid rh-flex-eq-height <?php echo (rehub_option('width_layout') =='extended') ? 'col_wrap_fifth' : 'col_wrap_fourth';?>"> <?php elseif (rehub_option('search_layout') == 'compactgridfull') : ?> <div class="eq_grid post_eq_grid rh-flex-eq-height <?php echo (rehub_option('width_layout') =='extended') ? 'col_wrap_six' : 'col_wrap_fifth';?>"> <?php elseif (rehub_option('search_layout') == 'dealgrid') : ?> <div class="eq_grid post_eq_grid rh-flex-eq-height <?php echo (rehub_option('width_layout') =='extended') ? 'col_wrap_fourth' : 'col_wrap_three';?>"> <?php elseif (rehub_option('search_layout') == 'dealgridfull') : ?> <div class="eq_grid post_eq_grid rh-flex-eq-height <?php echo (rehub_option('width_layout') =='extended') ? 'col_wrap_six' : 'col_wrap_fifth';?>"> <?php else : ?> <div class=""> <?php endif ;?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php if (rehub_option('search_layout') == 'blog') : ?> <?php include(rh_locate_template('inc/parts/query_type2.php')); ?> <?php elseif (rehub_option('search_layout') == 'newslist') : ?> <?php $type='2'; ?> <?php include(rh_locate_template('inc/parts/query_type1.php')); ?> <?php elseif (rehub_option('search_layout') == 'communitylist') : ?> <?php include(rh_locate_template('inc/parts/query_type1.php')); ?> <?php elseif (rehub_option('search_layout') == 'deallist') : ?> <?php include(rh_locate_template('inc/parts/postlistpart.php')); ?> <?php elseif (rehub_option('search_layout') == 'grid' || rehub_option('search_layout') == 'gridfull') : ?> <?php include(rh_locate_template('inc/parts/query_type3.php')); ?> <?php elseif (rehub_option('search_layout') == 'columngrid' || rehub_option('search_layout') == 'columngridfull') : ?> <?php include(rh_locate_template('inc/parts/column_grid.php')); ?> <?php elseif (rehub_option('search_layout') == 'cardblog' || rehub_option('search_layout') == 'cardblogfull') : ?> <?php include(rh_locate_template('inc/parts/color_grid.php')); ?> <?php elseif (rehub_option('search_layout') == 'compactgrid' || rehub_option('search_layout') == 'compactgridfull') : ?> <?php $gridtype = 'compact'; include(rh_locate_template('inc/parts/compact_grid.php')); ?> <?php elseif (rehub_option('search_layout') == 'dealgrid' || rehub_option('search_layout') == 'dealgridfull') : ?> <?php include(rh_locate_template('inc/parts/compact_grid.php')); ?> <?php else : ?> <?php include(rh_locate_template('inc/parts/query_type1.php')); ?> <?php endif ;?> <?php endwhile; ?> <?php rehub_pagination(); ?> <?php else : ?> <div class="no-results not-found"> <h5><?php esc_html_e('Sorry. No posts in this category yet', 'rehub-theme'); ?></h5> </div> <?php endif; ?> </div> <div class="clearfix"></div> </div> <!-- /Main Side --> <?php if (rehub_option('search_layout') == 'gridfull' || rehub_option('search_layout') == 'dealgridfull' || rehub_option('search_layout') == 'compactgridfull' || rehub_option('search_layout') == 'columngridfull' || rehub_option('search_layout') == 'cardblogfull' ) : ?> <!-- Sidebar --> <?php else:?> <?php get_sidebar(); ?> <!-- /Sidebar --> <?php endif ;?> </div> </div> <!-- /CONTENT --> <!-- FOOTER --> <?php get_footer(); ?>
It doesn’t seem to be making any queries there, so the extra queries are coming from somewhere else. It’s hard to say where, could be many places; that would’ve been the obvious place.
Try with Twenty Twenty (you don’t have to switch themes, you can just preview the theme and run a search) – does that cause double results in the logs? That will rule out whether this issues is caused by your theme.
Morning Mikko,
No problem. I’ll take a look, thanks.
If I can they it fixed, no biggy. As long as I see search terms I am content.
Thanks again.
- The topic ‘double stats on user searches’ is closed to new replies.