Advertisement:

Author Topic: How to display sub-subcategories on search sidebar  (Read 1409 times)

Dublay

  • Newbie
  • *
  • Posts: 33
How to display sub-subcategories on search sidebar
« on: February 18, 2016, 04:38:06 pm »
Hi there,

I want to display sub-subcategories in the search sidebar. Acutally only the main categories and on click the subcategories are displayed. Is there any way to add one more level to this menu?

Thanks in advance!

Dublay
« Last Edit: February 18, 2016, 04:40:51 pm by Dublay »

Dublay

  • Newbie
  • *
  • Posts: 33
Re: How to display sub-subcategories on search sidebar
« Reply #1 on: February 19, 2016, 12:58:29 am »
No ideas? I really think that this is possible...

Dublay

  • Newbie
  • *
  • Posts: 33
Re: How to display sub-subcategories on search sidebar
« Reply #2 on: February 19, 2016, 11:41:25 am »
I think this is the relevant part. How can I add one more level (subcategory level 2)

Code: [Select]
<?php if ( osc_count_categories() >= ) { ?>
<ul>
              <li><a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>"><?php _e('All categories''glider'); ?></a></li>

<?php while ( osc_has_categories() ) { ?>
<li>
                    <a<?php if ($sub==osc_category_slug()){echo " class='active'"; } ?> href="<?php echo osc_esc_html(osc_update_search_url(array('sCategory'=> osc_category_slug()))); ?>"><?php echo osc_category_name(); ?> <?php if( osc_get_preference('category_listing_count''glider_theme') !== '1') { ?><span class="count">(<?php echo osc_category_total_items(); ?>)</span><?php ?></a><?php if ($sub==osc_category_slug()){ ?>&nbsp;&nbsp;<a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>" class="active delete"><i class="ion-close-circled"></i></a><?php ?>
                   
                    <?php if($sub==osc_category_slug() || $parentCategory ['s_slug'] == osc_category_slug() ) { ?>
                    <ul>
                        <?php while ( osc_has_subcategories() ) { ?>
                        <?php if (osc_category_total_items() >= 1) { ?><li>
                        <a<?php if ($sub==osc_category_slug()){echo " class='active'";} ?> href="<?php echo osc_esc_html(osc_update_search_url(array('sCategory'=> osc_category_slug()))); ?>"><?php echo osc_category_name(); ?> <?php if( osc_get_preference('category_listing_count''glider_theme') !== '1') { ?><span class="count">(<?php echo osc_category_total_items(); ?>)</span><?php ?></a><?php if ($sub==osc_category_slug()){ ?>&nbsp;&nbsp;<a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>" class="active delete"><i class="ion-close-circled"></i></a><?php ?>
                        </li>
                        <?php ?>
                        <?php ?>
                    </ul>

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to display sub-subcategories on search sidebar
« Reply #3 on: February 19, 2016, 01:12:45 pm »
Hi,

I don't have that theme Glider to check if this is working, but looking at the logic of the code, I think this might work, at least in a roughly way: ???

Code: [Select]
<?php if ( osc_count_categories() >= ) { ?>
<ul>
              <li><a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>"><?php _e('All categories''glider'); ?></a></li>

    <?php while ( osc_has_categories() ) { ?>
<li>
                    <a<?php if ($sub==osc_category_slug()){echo " class='active'"; } ?> href="<?php echo osc_esc_html(osc_update_search_url(array('sCategory'=> osc_category_slug()))); ?>"><?php echo osc_category_name(); ?> <?php if( osc_get_preference('category_listing_count''glider_theme') !== '1') { ?><span class="count">(<?php echo osc_category_total_items(); ?>)</span><?php ?></a><?php if ($sub==osc_category_slug()){ ?>&nbsp;&nbsp;<a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>" class="active delete"><i class="ion-close-circled"></i></a><?php ?>

        <?php if($sub==osc_category_slug() || $parentCategory ['s_slug'] == osc_category_slug() ) { ?>
            <ul>
                <?php while ( osc_has_subcategories() ) { ?>
                <?php if (osc_category_total_items() >= 1) { ?><li>
                    <a<?php if ($sub==osc_category_slug()){echo " class='active'";} ?> href="<?php echo osc_esc_html(osc_update_search_url(array('sCategory'=> osc_category_slug()))); ?>"><?php echo osc_category_name(); ?> <?php if( osc_get_preference('category_listing_count''glider_theme') !== '1') { ?><span class="count">(<?php echo osc_category_total_items(); ?>)</span><?php ?></a><?php if ($sub==osc_category_slug()){ ?>&nbsp;&nbsp;<a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>" class="active delete"><i class="ion-close-circled"></i></a><?php ?>
                </li>
                    <?php ?>
               
                    <?php // Sub-subcategory block start ?>
                    <?php while ( osc_has_subcategories() ) { ?>
                        <ul>
                        <?php if (osc_category_total_items() >= 1) { ?><li>
                            <a<?php if ($sub==osc_category_slug()){echo " class='active'";} ?> href="<?php echo osc_esc_html(osc_update_search_url(array('sCategory'=> osc_category_slug()))); ?>"><?php echo osc_category_name(); ?> <?php if( osc_get_preference('category_listing_count''glider_theme') !== '1') { ?><span class="count">(<?php echo osc_category_total_items(); ?>)</span><?php ?></a><?php if ($sub==osc_category_slug()){ ?>&nbsp;&nbsp;<a href="<?php echo osc_update_search_url(array('sCategory' => null)); ?>" class="active delete"><i class="ion-close-circled"></i></a><?php ?>
                            </li>
                        </ul>
                        <?php ?>
                    <?php ?>
                    <?php // Sub-subcategory block end ?>
                <?php ?>
            </ul>

Regards

Dublay

  • Newbie
  • *
  • Posts: 33
Re: How to display sub-subcategories on search sidebar
« Reply #4 on: February 22, 2016, 12:57:30 pm »
Hi teseo,

thanks for your reply. Your code throws out an endless loop of the main-categorys like:

category1 (14)
category2 (21)
category1 (14)
category2 (21)
category1 (14)
category2 (21)
category1 (14)
category2 (21)
category1 (14)
category2 (21)

Do you have another idea?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to display sub-subcategories on search sidebar
« Reply #5 on: February 23, 2016, 06:08:28 pm »
Sorry, that was my best shot considering that I don't have that theme so I couldn't test anything myself. :(

Regards