*

mwindey

  • *****
  • 478 posts
Hide 1 specific category on main latest listings
« on: August 02, 2022, 10:05:48 AM »
I need to hide a specific category from showing on home page latest listing. Any setting or adjustment in file that can fix that?
I thought i saw this earlier on forum but i am not able to find it on search.
Thanks

*

MB Themes

Re: Hide 1 specific category on main latest listings
« Reply #1 on: August 02, 2022, 10:08:37 AM »
You should update function that prepare list and add there something like
Code: [Select]
$search->addCondition(DB_TABLE_PREFIX . 't_item.fk_i_category_id <> 123456');
($search & category id should be customized, maybe addItemCondition should be used instead)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 478 posts
Re: Hide 1 specific category on main latest listings
« Reply #2 on: August 02, 2022, 01:17:17 PM »
@MB Themes,

Thanks for reply but did not get it to work.... Probably i placed the code in the wrong place  :D
Anyway i have another solution that works:

In functions.php search:
Code: [Select]
function eps_random_items($numItems = 10, $category = array(), $withPicture = false) {
Add:
Code: [Select]
$excluded_categories = array(62);
Change 62 to category nr you want to exclude and if more categories need to be excluded use comma eg: 62,122,255 etc

Then find:
Code: [Select]
  if($withPicture) {
Before that line put:
Code: [Select]
if(!empty($excluded_categories)) {
      $excluded_categories_str = implode(', ', $excluded_categories);
      $whe .= ' AND '.DB_TABLE_PREFIX.'t_item.fk_i_category_id NOT IN ('.$excluded_categories_str.') ';
  }

Save/upload file and relax  :) ;)
« Last Edit: August 02, 2022, 03:27:01 PM by mwindey »

*

MB Themes

Re: Hide 1 specific category on main latest listings
« Reply #3 on: August 02, 2022, 03:17:33 PM »
Right in this phase it use pure SQL only
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 478 posts
Re: Hide 1 specific category on main latest listings
« Reply #4 on: August 02, 2022, 03:25:41 PM »
@MB Themes

So my solution is ok you think?
Just checking  ;)

*

MB Themes

Re: Hide 1 specific category on main latest listings
« Reply #5 on: August 02, 2022, 04:44:24 PM »
It is ok ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots