Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    red flag Highlight Currently Selected Category Background

    Hi All,
    Posted this in another thread, but think I was totally in the wrong place!
    New to the forum and a semi-beginner! Been fighting this for hours and trying to find an answer, but no luck! Here is my issue...

    Simply, would like to have a category background highlight to the same color as the hover, when that category is chosen!

    Seems like this should be simple, but all attempts have failed!

    Using 1.3.9h with a modified template.

    Here is my site http://www.ohio-electrical-training.com

    Really hope someone can point me in the right direction! Thanks in advance!

  2. #2
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Highlight Currently Selected Category Background


    Doesn't anyone have any ideas on this?

  3. #3
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: Highlight Currently Selected Category Background

    It's not clear to me what you're trying to accomplish. Can you rephrase/clarify the question?
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  4. #4
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Highlight Currently Selected Category Background

    Quote Originally Posted by afo View Post
    It's not clear to me what you're trying to accomplish. Can you rephrase/clarify the question?
    Thanks for the reply, afo!

    When you hover over any category on my left sidebar, the background changes to a tan/cream color. What I want to do is, when a category is clicked, and the contents are displayed on the page, I would like the clicked-category to "remain" as that tan/cream color, so the customer (at a glance) knows which category they are on!

    Seems common on most websites that the "current page tab" is highlighted in some way!

    Thanks, afo....

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

    Default Re: Highlight Currently Selected Category Background

    There is a class added to categories in the currrently selected path that can be used to do what you want. The Classic template uses this to make the current category path bold:

    SPAN.category-subs-parent {
    font-weight: bold;
    }
    SPAN.category-subs-selected {
    font-weight: bold;
    }

    Even though your Template Monster template has changed the categories menu structure (with good reason for a change:), you can still use those classes.
    Last edited by gjh42; 31 Jan 2011 at 04:55 PM.

  6. #6
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Highlight Currently Selected Category Background

    Quote Originally Posted by gjh42 View Post
    There is a class added to categories in the currrently selected path that can be used to do what you want. The Classic template uses this to make the current category path bold:

    SPAN.category-subs-parent {
    font-weight: bold;
    }
    SPAN.category-subs-selected {
    font-weight: bold;
    }

    Even though your Template Monster template has changed the categories menu structure (with good reason for a change:), you can still use those classes.
    Thank you so much, gjh42! I did notice the class defined in the Classic Template css, but didn't notice that it was missing from my template css!

    Now added, the category text achieves the effect I was looking for, but not the whole "box-body", but this is ok! Lets the customer know what tab they are on, with a slightly different effect then the hover!

    Works for me!

    Thank you much, ghj42!

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

    Default Re: Highlight Currently Selected Category Background

    The links are inline elements by default, which means that they are no bigger than their text. If you change them to display: block; they will take on the full sidebox width. You will then also need to eliminate the <br /> between each link, which will now add an extra space between links.

    #categories a, #categories a span {display: block;}
    #categories a+br {display: none;}
    Last edited by gjh42; 31 Jan 2011 at 06:02 PM.

  8. #8
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Highlight Currently Selected Category Background

    Quote Originally Posted by gjh42 View Post
    The links are inline elements by default, which means that they are no bigger than their text. If you change them to display: block; they will take on the full sidebox width. You will then also need to eliminate the <br /> between each link, which will now add an extra space between links.

    #categories a, #categories a span {display: block;}
    #categories a+br {display: none;}
    Thanks again, gjh42! I think I lik the current style. Lets the customer know where they are, but less intense then having the whole box highlighted!

    I do have another related question though, if you'd be so kind....

    I have an additional sidebox created below categories. In it, I have "links" to "sub-categories" from a top-category that is "hidden" in the main category box! You had posted that code in another thread, and it worked like a charm, so that the subs wouldn't display twice!

    Well, I would like to also highlight this sub-category in the additional sidebox when chosen (just like in main category)

    Question is...
    How do I call the current displayed sub-category from this additional sidebox?

    Tried using an "if" as below, but not working...
    if ($current_page_base['path'] == 'cPath=18_56') {

    Could you help me with this? Thanks again!

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

    Default Re: Highlight Currently Selected Category Background

    I don't recall which thread I posted that info in, or when - can you point to it? The sidebox does not now have any identifier for current category. I would need to see probably the module file for the sidebox to know what code would work there.

  10. #10
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Highlight Currently Selected Category Background

    Quote Originally Posted by gjh42 View Post
    I don't recall which thread I posted that info in, or when - can you point to it? The sidebox does not now have any identifier for current category. I would need to see probably the module file for the sidebox to know what code would work there.
    The code you posted to hide a category link is in post #10 in this thread!

    The sidebox mod is called Editable Sideboxes. The Support Thread is here!

    I've simply used a direct link to each sub-category that I've added to the editable sidebox. The main file to edit I've renamed to "reference_sidebox.php", and the whole file code is below...

    Code:
    <?php
    /**
     * editable sidebox - allows an admin-editable sidebox to be added to your site
     *
     * @package templateSystem
     * @copyright 2007 Kuroi Web Design
      * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: blank_sidebox.php 2007-08-10 kuroi $
     */
    
      // test if box should display
      $show_reference_sidebox = true;
    
      // $define_sidebox_ref = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', DEFINE_REFERENCE_SIDEBOX_NAME, 'false');
    
    if ($current_page_base['path'] == '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_56">') {
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_56"><span class="box-body">2011 Code Books & Tabs</span></a>';
    	}else{
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_56">2011 Code Books & Tabs</a>';
    	}
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_57">Solar Photovoltaic Sys.</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_58">NEC Code Changes Books</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_59">Training Library w/DVDs</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_60">License Exam Preparation</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_61">Estimating & Business Books</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_62">Elect. Calculation Books</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_63">NEC Article Books / DVDs</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_64">Elect. Theory Books / DVDs</a>';
    	$define_sidebox_ref[] = '<a href="http://www.ohio-electrical-training.com/index.php?main_page=index&cPath=18_65">Understanding The NEC</a>';
    
      if ($show_reference_sidebox == true) {
          require($template->get_template_dir('tpl_reference_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reference_sidebox.php');
          $title =  BOX_HEADING_REFERENCE_SIDEBOX;
          $title_link = false;
          require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
     }
    ?>
    You can see in the code above that I made an attempt to use an "if" statement to highlight the box, but it did nothing!

    Thanks for your help!

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Flyout Menu highlight current category
    By scott_ease in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 28 Jul 2012, 06:06 PM
  2. Trying to make new sub category, currently unable.
    By Tamuren in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 29 Jul 2011, 06:57 PM
  3. How to add background highlight for product listing?
    By time111 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Sep 2010, 10:16 PM
  4. how to insert a background colour for a selected category
    By jon22 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Dec 2009, 04:21 PM
  5. BetterCategories, Selected category
    By esoin in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 7 May 2008, 12:36 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR