*

webcity

  • *****
  • 252 posts
How to stop banner showing in mysite.com/search
« on: May 01, 2021, 12:11:25 PM »
Hi,

I've setup a banner and a group, selected the banner to show in one category, and this works OK and shows in the selected category..

When I view mysite.com/search to show all listings, the banner I have created shows even though I haven't created a banner to show here.

Can you please suggest how I stop showing a banner in the mysite.com/search results?

Many thanks


Marked as best answer by frosticek on May 01, 2021, 08:36:49 PM
*

MB Themes

Re: How to stop banner showing in mysite.com/search
« Reply #1 on: May 01, 2021, 08:36:37 PM »
@webcity
In index.php of plugin find this code:
Code: [Select]
function show_banner( $id_name, $only_banner = NULL, $stats_not_count = NULL ) {
  //Get ID, if shortname
  if(is_int($id_name)) {
    $id = $id_name;
  } else {
    $b = ModelAds::newInstance()->getBannerGroup( '', '', $id_name );
    $id = isset($b['b_id']) ? $b['b_id'] : 0;
  }

  //Category check
  $cat = osc_search_category_id();
  $cat = isset($cat[0]) ? $cat[0] : '';

and change it into:
Code: [Select]
function show_banner( $id_name, $only_banner = NULL, $stats_not_count = NULL ) {
  //Get ID, if shortname
  if(is_int($id_name)) {
    $id = $id_name;
  } else {
    $b = ModelAds::newInstance()->getBannerGroup( '', '', $id_name );
    $id = isset($b['b_id']) ? $b['b_id'] : 0;
  }

  //Category check
  $cat = osc_search_category_id();
  $cat = isset($cat[0]) ? $cat[0] : '';

  if(($cat == 0 or $cat == '') && osc_is_search_page()) {
    return false;
  }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

webcity

  • *****
  • 252 posts
Re: How to stop banner showing in mysite.com/search
« Reply #2 on: May 02, 2021, 03:25:28 AM »
Thanks for your help.

That solved the problem, all works great now :-)