Osclass forums

Support forums => General help => 3.6.x => Topic started by: Dublay on February 18, 2016, 04:38:06 pm

Title: How to display sub-subcategories on search sidebar
Post by: Dublay 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
Title: Re: How to display sub-subcategories on search sidebar
Post by: Dublay on February 19, 2016, 12:58:29 am
No ideas? I really think that this is possible...
Title: Re: How to display sub-subcategories on search sidebar
Post by: Dublay 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>
Title: Re: How to display sub-subcategories on search sidebar
Post by: teseo 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
Title: Re: How to display sub-subcategories on search sidebar
Post by: Dublay 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?
Title: Re: How to display sub-subcategories on search sidebar
Post by: teseo 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