Results 1 to 10 of 15

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Only active category with sub-categories in sidebox?

    Is there any way to hide categories in the sidebox so that the sidebox only shows the sub-categories of active top-category. All the other top-categories should be hidden. Main page (Home) should still have all the top-categories available.

    As you enter the shop you should see all the categories: for example monitors, games, dvd's etc.. You make your choise and at the next page you see only subcategories for dvd's: action, comedy....

    I have tried to do this with css and templates and it's easy to get top-categories off, but the main page remains as a problem.

    Thanks,
    Jarsa

  2. #2
    Join Date
    Sep 2006
    Posts
    281
    Plugin Contributions
    0

    Default Re: Only active category with sub-categories in sidebox?

    Are you saying that you want to hide all the other top categories once they go into a sub category?
    [FONT="Georgia"]Samuel Turnmire[/FONT]
    [FONT="Century Gothic"]co-Founder[/FONT]
    [FONT="Book Antiqua"]geekFoundry[/FONT]

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Only active category with sub-categories in sidebox?

    I don't think forcing all navigation through the home page is generally a good idea, but if that's what you really want...

    Just a preliminary thought -

    There are tags for the active category and subs. You could use those in your main stylesheet with display: none; and make an index_home.css (in the same folder) with display: block; or inline;...
    (Clarification: Set everything but those tags to display none or block.)

    Now I don't know without studying the file for it whether this will get rid of the space or just the text. If the latter, code work will be required. I'll look at it and get back; I think a simplified version of the code developed in the Parent Categories Separated In 3 sideboxes will work.
    Last edited by gjh42; 22 May 2007 at 02:34 PM.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Only active category with sub-categories in sidebox?

    This is the line in tpl_categories.php that decides whether a category gets displayed:

    PHP Code:
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
            
    // skip if this is for the document box (==3)
          
    } else { 
    This line has a test for the current category:

    if ($box_categories_array[$i]['current']) {

    A subcategory will have a _ in the cPath, but a top category won't.

    So you could add a test for the category being a top cat and not current, and skip it:

    or (!ereg("_",$cPath) and !$box_categories_array[$i]['current'])



    PHP Code:
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1) or (!ereg("_",$cPath) and !$box_categories_array[$i]['current'])) {
            
    // skip if this is for the document box (==3) or non-current top cat(_, current)
          
    } else { 
    You could also use

    or ($box_categories_array[$i]['top'] == 'true' and !$box_categories_array[$i]['current'])

    as a test.
    Last edited by gjh42; 22 May 2007 at 04:46 PM.

  5. #5
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Only active category with sub-categories in sidebox?

    Thanks for replies,

    CSS solution leaves empty spaces if I did everything correctly.

    This template thing is easy and great way to solve problem. Thanks! But if I didn't mess something up the Home page sidebox looses it's categories too. This is not something too serious for me though, because the main page is going to be different anyway. But if there is another just as simple and elegant solution for Home page, I'll be listening.

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Only active category with sub-categories in sidebox?

    Oops! The code I had put in for discriminating between home page & others got lost while reworking the approach to category discrimination. This occurred to me last night. To fix this, add

    and !$this_is_home_page

    to the test:
    PHP Code:
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1) or (!ereg("_",$cPath) and !$box_categories_array[$i]['current'] and !$this_is_home_page)) {
            
    // skip if this is for the document box (==3) or non-current top cat(_, current) & not homepg
          
    } else { 

  7. #7
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Only active category with sub-categories in sidebox?

    Ok Glenn, it works beatifully and it was great solution. What more can I say than Thank You. And I hope we all can learn from you how to help fellow Zenners.

    -Jarsa-

  8. #8
    Join Date
    Aug 2006
    Posts
    166
    Plugin Contributions
    2

    Default Re: Only active category with sub-categories in sidebox?

    Quote Originally Posted by gjh42 View Post
    Oops! The code I had put in for discriminating between home page & others got lost while reworking the approach to category discrimination. This occurred to me last night. To fix this, add

    and !$this_is_home_page

    to the test:
    PHP Code:
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1) or (!ereg("_",$cPath) and !$box_categories_array[$i]['current'] and !$this_is_home_page)) {
            
    // skip if this is for the document box (==3) or non-current top cat(_, current) & not homepg
          
    } else { 
    hi gjh24
    excuse me, this last one? I didn't get exactly,
    actually, I have installed multisite zen 1.3.7, and if you know, this module filter the categories for the site that you want to be shown.
    but the question is now, I want to have the category name as the name of the site, because each category has many subcategory, so, I like to disapear showing top category name in the side box, but the first high level category name that is shown , be the subcategory mevel 1 etc.

    I tried to replace your code, in template default/sideboxes, but it didn't change any thing on my fresh zen cart1.3.7 without multisite module. I did put this changed file also in mytemplate/sidebox, and the result was nothing.
    any help,

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Only active category with sub-categories in sidebox?

    I know nothing about the inner workings of the multisite mod, and if it uses the same sort of code for discrimination, fitting the two purposes together could be very tricky.

    I would need to see your site to know just what you have done. Can you post a link?

  10. #10
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Only active category with sub-categories in sidebox?

    Here again with new problems,

    everything works fine until you visit information pages etc. -> categories are empty again. Now, it should be fairly easy to get all categories to sidebox (homepage style), but how to get just the catalog where visitor were before information pages?

 

 

Similar Threads

  1. v151 display only sub-categories of category X
    By godt in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 10 Jan 2014, 07:05 AM
  2. How can I hide sub sub categories of a category in left sidebox?
    By X-Bumble in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 15 Feb 2012, 07:11 PM
  3. Reduce category sidebox to only sub-categories
    By Jeff G in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 20 Nov 2007, 12:48 AM
  4. How to hide sub-categories with no active products?
    By donplay in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 29 Aug 2007, 08:20 PM
  5. Click on Category in Sidebox and Only Open Sub-Cat In Sidebox, Not In Main Store
    By bamalama in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 17 Dec 2006, 04:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg