*

pitbull

  • ***
  • 98 posts
Need help for search function !
« on: February 19, 2018, 01:51:14 PM »
Hi @frosticek. I am trying to display the search pattern in the search page so every time someone searching for eg "Mercedes" it shall echo the message "You are looking for Mercedes" at the top of the page results. I already added the function that gets the current search pattern and i am able to display the word "Mercedes". So far so good but i need an "if" statement so i can add also the sentence  "You are looking for", because as it is now it displays always this sentence when you visit the search results page by browsing categories for example, and i want to display the sentence only when someone performs a search.

Any idea/direction ??

Many thanks

Marked as best answer by pitbull on February 20, 2018, 08:54:51 AM
*

MB Themes

Re: Need help for search function !
« Reply #1 on: February 19, 2018, 02:16:53 PM »
@pitbull
Code: [Select]
if(osc_search_pattern() <> '') {
  echo sprintf(__('You are looking for %s', 'veronika'), osc_search_pattern());
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

pitbull

  • ***
  • 98 posts
Re: Need help for search function !
« Reply #2 on: February 20, 2018, 08:54:46 AM »
@pitbull
Code: [Select]
if(osc_search_pattern() <> '') {
  echo sprintf(__('You are looking for %s', 'veronika'), osc_search_pattern());
}


Thanks @frosticek it worked fine ! You should implement it to the next updates of your themes ;)

*

siken

  • ****
  • 138 posts
Re: Need help for search function !
« Reply #3 on: February 23, 2018, 03:35:18 PM »
or this, for desktop and mobile, and clean search ;-)

search in search.php this line and replace:     <!-- HELPERS FORS AJAX SEARCH -->

Code: [Select]
<?php if( osc_search_pattern() <> '') { ?>
<div class="hidden-xs">&nbsp;<br class="hidden-xs" style="margin:20px 0px -20px 0px;">
<div style="font-weight:bold;">
<table>
<td>
<i><i class="fa fa-search-plus"></i>&nbsp;&nbsp;<?php if(osc_search_pattern() <> '') {
  echo 
sprintf(__('resultados con el término: %s''veronika'), osc_search_pattern());
?>
</i>
</td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>
&nbsp;<br/>
<a class="btn btn-info btn-sm" style="color:#fff;" href="<?php echo osc_search_url(array('page' => 'search'));?>" class="clear-search clear-cookie"><i class="fa fa-eraser"></i> <?php _e('Clean fields''veronika'); ?></a>
</td>
</table>
</div>
</div>
<div class="visible-xs">&nbsp;<br style="margin:-40px 0px 40px 0px;">
<div>
<table>
<tr>
<hr style="width=100%; margin:-20px 0px 10px 0px;">
<i><strong><i class="fa fa-search-plus"></i>&nbsp;&nbsp;<?php if(osc_search_pattern() <> '') {
  echo 
sprintf(__('resultados con el término: %s''veronika'), osc_search_pattern());
?>
</strong></i>
&nbsp;<br>
</tr>
<tr>
      <div class="counter" style="color:#777777;">
        <?php if(osc_search_total_items() == 0) { ?>
          <?php _e('No listings''veronika'); ?>
        <?php } else { ?>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo osc_default_results_per_page_at_search()*(osc_search_page())+1;?> - <?php echo osc_default_results_per_page_at_search()*(osc_search_page()+1)+osc_count_items()-osc_default_results_per_page_at_search();?> <?php echo ' ' __('of''veronika') . ' '?> <?php echo osc_search_total_items(); ?> <?php echo (osc_search_total_items() == __('listing''veronika') : __('listings''veronika')); ?>                                                           
        <?php ?>
      </div>
</tr>
<tr>
<div style="margin:-12px 0px 0px 0px;">&nbsp;</div>
<a class="btn btn-info btn-sm" style="color:#fff;" href="<?php echo osc_search_url(array('page' => 'search'));?>" class="clear-search clear-cookie"><i class="fa fa-eraser"></i> <?php _e('Clean fields''veronika'); ?></a>
&nbsp;<br>
<hr style="width=100%; margin:20px 0px 20px 0px;">
</tr>
</table>
</div>
</div>
<?php ?>
    <!-- HELPERS FORS AJAX SEARCH -->
« Last Edit: February 23, 2018, 03:43:38 PM by alexandromt »

*

nijamutheen

  • ****
  • 110 posts
Re: Need help for search function !
« Reply #4 on: February 28, 2018, 03:39:57 PM »
My mobile search Ajax is not working ?

*

MB Themes

Re: Need help for search function !
« Reply #5 on: February 28, 2018, 04:41:57 PM »
There is no mobile ajax search.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots