Osclass forums
Support forums => General help => 3.6.x => Topic started 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
-
No ideas? I really think that this is possible...
-
I think this is the relevant part. How can I add one more level (subcategory level 2)
<?php if ( osc_count_categories() >= 0 ) { ?>
<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()){ ?> <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()){ ?> <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>
-
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: ???
<?php if ( osc_count_categories() >= 0 ) { ?>
<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()){ ?> <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()){ ?> <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()){ ?> <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
-
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?
-
Sorry, that was my best shot considering that I don't have that theme so I couldn't test anything myself. :(
Regards