Advertisement:

Author Topic: [SOLVED] osclasswizards categories  (Read 5248 times)

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
[SOLVED] osclasswizards categories
« on: June 11, 2015, 10:14:40 pm »
This is an awesome theme but it doesnt appear that you can mod it as easily as in say a bender theme.

I would like to use drop down menu selection buttons for each of the categories that are shown on the home page.

I only want to show the main category initially and not show any subcategories directly under it on the homepage. Instead I would like to be able to click on a main category topic and then have it open to show all the available subcategories directly below it for each of the main categories shown on the home page.

And only then once a selection is made from the subcategories should it go to the listings page.

Has anybody else tried doing this? Can any body help with this. Even if only suggestions. Thanks in advance for your help.

« Last Edit: June 13, 2015, 02:03:24 am by whoopwhoopler »

Layonel

  • Newbie
  • *
  • Posts: 1
Re: [SOLVED] osclasswizards categories
« Reply #1 on: June 18, 2015, 03:05:17 am »
I'm trying to do it if anyone can help I will be thankful because I have not had success
You could friend?

stuartthfc

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] osclasswizards categories
« Reply #2 on: June 19, 2015, 03:13:50 pm »
Hi :-)

Can you please share how you solved this as it is something many people in the community are hoping to achieve. I have been playing with the script for 2 days now lol.

Many thanks in anticipation of your reply.

Stuart

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #3 on: June 19, 2015, 11:23:25 pm »
Hi :-)

Can you please share how you solved this as it is something many people in the community are hoping to achieve. I have been playing with the script for 2 days now lol.

Many thanks in anticipation of your reply.

Stuart

I am showing my functions.php file for your use. I have sent the same file to osclasswizards for them to look at as well. Once you make the changes to the functions.php file make sure to raise the subcategory limit in the admin panel to 100. That way all the subcategories show when you click the main category. The changes that need to be made are in line 61 - set it to "0" the go to lines 374 to 382 and make tyhose changes as well and you wiull have your dropdown categories. I added to span class for the badges to align properly so dont forget to make those changes as well in the same lines.

Whoop Whoop!

Find the following code around line 61... and set the sub cat limit to "0"


//templates

   if( !osc_get_preference('search_select', 'osclasswizards_theme') ) {
      osc_set_preference('search_select', 'region', 'osclasswizards_theme');
   }
   
   if( !osc_get_preference('sub_cat_limit', 'osclasswizards_theme') ) {
      osc_set_preference('sub_cat_limit', 0, 'osclasswizards_theme');
    }
   
   if( !osc_get_preference('popular_regions_limit', 'osclasswizards_theme') ) {
      osc_set_preference('popular_regions_limit', 10, 'osclasswizards_theme');

Then go to the code around line 372 to 384 and make these changes...

  <section class="listings">
 
    <h2><i class="fa fa-<?php echo osclasswizards_category_icon( osc_category_id() ); ?>"></i>
      <?php
                    $_slug      = osc_category_slug();
                    $_url       = osc_search_category_url();
                    $_name      = osc_category_name();
                    $_total_items = osc_category_total_items();
                    if ( osc_count_subcategories() > 0 ) { ?>
     
      <?php } ?>
      <?php if($_total_items > 0) { ?>
      <a class="category <?php echo $_slug; ?>" href="<?php echo $_url; ?>"><?php echo $_name ; ?></a>
      <?php } else { ?>
      <a class="category <?php echo $_slug; ?>" href="#"><?php echo $_name ; ?></a>
      <?php } ?>
    </h2>   
    <div class="dropdown">
   <button class="btn btn-default btn-block dropdown-toggle" type="button" data-toggle="dropdown">
   <span class="caret"></span></button>
   <ul class="dropdown-menu btn-block">

   
    <?php if ( osc_count_subcategories() > 0 ) { $m=1; ?>
    <ul class="list-group">
      <?php while ( osc_has_subcategories() ) { if( $m<=(osc_get_preference('sub_cat_limit', 'osclasswizards_theme'))){?>
      <li class="list-group-item">
        <?php if( osc_category_total_items() > 0 ) { ?>
        <a class="category sub-category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span class="badge"><?php echo osc_category_total_items() ; ?></span>
        <?php } else { ?>
        <a class="category sub-category <?php echo osc_category_slug() ; ?>" href="#"><?php echo osc_category_name() ; ?></a> <span class="badge"><?php echo osc_category_total_items() ; ?></span>
        <?php } ?>
      </li>

Then make sure to change the subcategory limit in the admin panel to 100

Save and refresh your screen - you should have what you want...

Whoop Whoop!

stuartthfc

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] osclasswizards categories
« Reply #4 on: June 20, 2015, 08:41:31 pm »
Hi Whoop Whoop,

I really appreciate you taking the time to reply and share that. Unfortunately my functions.php does not have the code around line 61 -   

 if( !osc_get_preference('sub_cat_limit', 'osclasswizards_theme') ) {
      osc_set_preference('sub_cat_limit', 0, 'osclasswizards_theme');

- or anywhere else in that file for some reason.  It had all the other code further down though so I tried changing the rest just to see if it worked anyhow but it just left a drop down menu that was out of position :-(

Oswizzard must have made major changes to the function.php file at some point whilst updating their amazing theme. It is a great shame as I think the theme would be much better for users of mobile phones if there was an option to just show the parent catergory, instead of having to scroll down every subcatergory.

Dont suppose anyone has any further suggestions? I can upload the function.php file if that will help.

Thanks again Whoop Whoop :-)

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #5 on: June 20, 2015, 10:28:02 pm »
First things first - what version of Osclasswizards are you using? There have been changes. The mods I made were for version 2.0.0

You are right about the mobile phone users and having to scroll down all the sub-categories to get to what you want. Thats why I had made the mod that I did especially if you have more than 12 main categories.

Are you willing to share your functions.php file with me for me to look at? Maybe I can make some suggestions or at least let me see what you are looking at.
« Last Edit: June 20, 2015, 10:37:48 pm by whoopwhoopler »

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #6 on: June 20, 2015, 11:21:03 pm »
Hi Whoop Whoop,

I really appreciate you taking the time to reply and share that. Unfortunately my functions.php does not have the code around line 61 -   

 if( !osc_get_preference('sub_cat_limit', 'osclasswizards_theme') ) {
      osc_set_preference('sub_cat_limit', 0, 'osclasswizards_theme');

- or anywhere else in that file for some reason.  It had all the other code further down though so I tried changing the rest just to see if it worked anyhow but it just left a drop down menu that was out of position :-(


Oswizzard must have made major changes to the function.php file at some point whilst updating their amazing theme. It is a great shame as I think the theme would be much better for users of mobile phones if there was an option to just show the parent catergory, instead of having to scroll down every subcatergory.

Dont suppose anyone has any further suggestions? I can upload the function.php file if that will help.

Thanks again Whoop Whoop :-)

Not sure why you dont have the same code but look at the following lines between (or around depending on your hacks) lines 354 - 377. Bootstrap acknowledges there will be some misalignment given certain setting parameters. In any event...concentrate on the red...

<h1 class="title"><?php _e('Categories', 'yoursite');?></h1>
<div class="row">
<?php
   //cell_3
   $total_categories   = osc_count_categories();
   $col1_max_cat       = ceil($total_categories/1);

   osc_goto_first_category();
   $catcount   =   0;
   while ( osc_has_categories() ) {
?>

<ul class="col-md-6 col-lg-3 grid_list">
  <li>

 
  <section class="listings">
 
    <h2><i class="fa fa-<?php echo yoursite_category_icon( osc_category_id() ); ?>"></i>
      <?php
                    $_slug      = osc_category_slug();
                    $_url       = osc_search_category_url();
                    $_name      = osc_category_name();
                    $_total_items = osc_category_total_items();
                    if ( osc_count_subcategories() > 0 ) { ?>

Around line 409 (depending on your hacks) find this code... and concentrate on this number in red...

<?php
      $catcount++;
      if($catcount%4==0)
      {
         echo '</div><div class="row">';
      }
    }
 ?>

Those two settings in red control the number columns and the category spacing as the page is resized in the browser viewport. The settings used here allow 4 columns at full screen desktop. When starting to resize the screen or viewport they drop to show 2 columns at a smaller screen for tablet and then drop again to 1 column at the mobile device screen size.

To get the columns to align and categories shown right you need to play around with these parameters. Short of these things I am not sure I can help any more without seeing your functions.php file.

Whoop Whoop!
 
« Last Edit: June 20, 2015, 11:24:25 pm by whoopwhoopler »

stuartthfc

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] osclasswizards categories
« Reply #7 on: June 20, 2015, 11:28:03 pm »
Hi Whoop Whoop :-)

Thanks once again for your reply. I will look into that right now and again i appreciate you taking the time to help.  I have attached my function.php which I havent edited or anything so was standard when I downloaded it several months back.

I will feed back on your latest suggestion.......Fingers Crossed.

Thanks Again,
Stuart

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #8 on: June 20, 2015, 11:36:18 pm »
I just opened your functions.php file and see that you have version 1.0.7. You should at least upgrade to the 2.0.0 version now - its free. That will resolve some of your issues and take care of some other issues that you havent seen yet.
« Last Edit: June 20, 2015, 11:43:53 pm by whoopwhoopler »

stuartthfc

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] osclasswizards categories
« Reply #9 on: June 21, 2015, 12:58:00 am »
Hi again Whoop Whoop,

Right I have updated everything and changed what you advised in your earlier posts as directed. I now have what is in the picture......However I havent set the sub cats to 100 in admin as embarassingly I cannot find it.  Is it part of a plugin do you know or a standard setting?  Anway I appreciate you telling me to update, as I said I only downloaded it afew weeks back anyhow......Things are moving fast eh lol.

Thanks,
Stuart


whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #10 on: June 21, 2015, 03:41:27 am »
In the admin panel click on the paint can (4th from the top) when it opens you will see several selections including osclasswizards.

Select osclasswizards. It will show you additional setting to be made.

Click on the Templates tab. The 5th item shown is the number of sub-categories to show. It may have a 5 or 6 in it. Set it 100 - which is the maximum. That way all your sub categories will be shown when the main category is selected instead of just sending you to a search page.

Let me know how you do

Whoop Whoop!

biztechnics

  • Newbie
  • *
  • Posts: 3
Re: [SOLVED] osclasswizards categories
« Reply #11 on: June 21, 2015, 05:10:54 am »
Hi whoop whoop,

Thks a lot for that piece of code, that is working great and just what I was looking for!!

This is a must "option" if a classified is to be mobile friendly.

Thanks again
Alain


whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #12 on: June 21, 2015, 06:07:12 am »
I am happy to find out that I was not the only one thinking about mobile users and I am more than happy that it worked out for you as well.

I appriciate your response.

Whoop Whoop!

stuartthfc

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] osclasswizards categories
« Reply #13 on: June 23, 2015, 08:52:50 pm »
Hi Whoop Whoop,

Apologies about the delay in responding :-) I got it perfect, all thanks to you. I hope one day I can repay the favour and help you with something. Been awhile since I used Osclass and its moved on alot since then - hence me been rusty. Anyway you're a star and I wish you well. I think the community will benefit from this post so another BIG THANKS lol.

Greatfully,
Stuart

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: [SOLVED] osclasswizards categories
« Reply #14 on: June 23, 2015, 11:07:19 pm »
Hi Whoop Whoop,

Apologies about the delay in responding :-) I got it perfect, all thanks to you. I hope one day I can repay the favour and help you with something. Been awhile since I used Osclass and its moved on alot since then - hence me been rusty. Anyway you're a star and I wish you well. I think the community will benefit from this post so another BIG THANKS lol.

Greatfully,
Stuart

Yo Stuart -

I was wondering where you went since it appeared that you were on fire to solve some of your issues with this Theme and Osclass. I am happy the hack worked out for you and that you are happy with it in the end. You never know from where help will appear. So I look forward to the day that I will be saved by some unknown soul. Congratulations on sticking with it and getting it to work. Patience is golden! I am still trying to make that hack better and one day it will work out too. I will let you know when that happens so you can check it out as well.

Whoop Whoop!