Osclass forums

Support forums => Themes => Twitter => Topic started by: fezanna on March 27, 2014, 03:01:17 pm

Title: Category and subcategory
Post by: fezanna on March 27, 2014, 03:01:17 pm
Hi,

I would like to be able to search, first select the category and then the sub-category.

this is the code that right now I show all categories and subcategories.




<select name="sCategory" id="sCategory" class="selectpicker" data-width="100%" >
                     <option value=""><?php _e('Tutte le Categorie', 'metrobar'); ?></option>
                     <?php osc_goto_first_category();
                           while ( osc_has_categories() ) { ?>

                           <optgroup label="<?php echo osc_category_name() ; ?>">

                              <?php  $i = 0; while ( osc_has_subcategories() ) { ?>
                              <option value="<?php echo osc_category_id() ; ?>" <?php if(Params::getParam('sCategory') == osc_category_id()) { ?>selected<?php } ?>><?php echo osc_category_name() ; ?></option>            
                              <?php $i++ ; } ?>
                                 <?php View::newInstance()->_erase('subcategories') ; ?>
                           </optgroup>

   <?php } ?>
</select>
Title: Re: Category and subcategory
Post by: design on April 24, 2014, 06:53:02 pm
you can see in another theme, swap code around ;-)