*

benefo

  • *
  • 4 posts
Subcategory Problem
« on: May 15, 2024, 05:47:13 PM »
How do I show the list of subcategories when entering the main category?

example : Category title (h1) |> Subcategory list title (h2).

Now :

My request :
« Last Edit: May 15, 2024, 06:28:54 PM by benefo »

*

benefo

  • *
  • 4 posts
Re: Subcategory Problem
« Reply #1 on: May 15, 2024, 09:50:43 PM »
Isn't there anyone who can help?
Loop.php


$loopClass = '';
$type = 'items';
if(View::newInstance()->_exists('listType')){
    $type = View::newInstance()->_get('listType');
}
if(View::newInstance()->_exists('listClass')){
    $loopClass = View::newInstance()->_get('listClass');
}
?>
<ul class="listing-card-list <?php echo $loopClass; ?>" id="listing-card-list">
    <?php
        $i = 0;

        if($type == 'latestItems'){
            while ( osc_has_latest_items() ) {
                $class = '';
                if($i%3 == 0){
                    $class = 'first';
                }
                benny_draw_item($class);
                $i++;
            }
        } elseif($type == 'premiums'){
            while ( osc_has_premiums() ) {
                $class = '';
                if($i%3 == 0){
                    $class = 'first';
                }
                benny_draw_item($class,false,true);
                $i++;
                if($i == 3){
                    break;
                }
            }
        } else {
            benny_search_ads_listing_top_fn();
            while(osc_has_items()) {
                $i++;
                $class = false;
                if($i%4 == 0){
                    $class = 'last';
                }
                $admin = false;
                if(View::newInstance()->_exists("listAdmin")){
                    $admin = true;
                }

                benny_draw_item($class,$admin);

                if(benny_show_as()=='gallery') {
                    if($i%8 == 0){
                        osc_run_hook('search_ads_listing_medium');
                    }
                } else if(benny_show_as()=='list') {
                    if($i%6 == 0){
                        osc_run_hook('search_ads_listing_medium');
                    }
                }
          }
        }
    ?>
</ul>

*

MB Themes

Re: Subcategory Problem
« Reply #2 on: May 18, 2024, 08:51:23 AM »
If selected category id is stored in $cat_id variable, then use:
Code: [Select]
Category::newInstance()->findSubcategoriesEnabled($cat_id);
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

benefo

  • *
  • 4 posts
Re: Subcategory Problem
« Reply #3 on: May 21, 2024, 09:52:35 AM »
Hello,
I'm using the Benny theme and unfortunately your method didn't work.

Why can't I access the subcategories when I go to the main category?
I have to go back to the homepage to access the subcategories.

example : https://gamma.mb-themes.com/services

I need your help on this issue.

Regards...
« Last Edit: May 21, 2024, 10:15:04 AM by benefo »

*

MB Themes

Re: Subcategory Problem
« Reply #4 on: May 22, 2024, 07:07:38 AM »
It always work.
Use it properly.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots