Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default is on-state look available for navigation?

    Is there a way in zen-cart to set up an on-state look for the navigation?

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

    Default Re: is on-state look available for navigation?

    Not built in, but anything can be coded. A test for $current_page_base == 'whatever' would give you the basis for setting a "currentPage" class, which could be styled in the stylesheet.

    The categories sidebox already has the classes for this available and ready to be styled. The Classic template uses these classes.

  3. #3
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: is on-state look available for navigation?

    I'm a real novice at PHP. So say I wanted to apply an additional class to a navigation list item using this method, how would I alter the code? Currently, I have the navigation in its own component (navigation.php) and inserting in on the main page template. Here's the basic structure for the nav items:

    <ul id="mainnav">
    <li id="nav_home"><a href="[link to home page]">Home</a></li>
    [other nav list here]
    </ul>

    I'm thinking the best way is to use the $current_page_base to add a class to the list item so that it looks like this:

    <li id="nav_home" class="currentpage"><a href="[link to home page]">Home</a></li>

    PHP-wise, how would I code that?

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

    Default Re: is on-state look available for navigation?

    If you're going to add code to highlight the current page link, you might as well make it not a link to itself at the same time. It's a good practice to avoid links that lead to exactly where you are - they serve no purpose.
    PHP Code:
    <?php if($this_is_home_page){ ?>
    <li id="nav_home" class="currentpage">Home</li>
    <?php }else{ ?>
    <li id="nav_home" class="notcurrentpage"><a href="[link to home page]">Home</a></li>
    <?php ?>

    <?php if($current_page_base == 'contact_us'){ ?>
    <li id="nav_contact" class="currentpage">Contact Us</li>
    <?php }else{ ?>
    <li id="nav_contact" class="notcurrentpage"><a href="[link to contact page]">Contact Us</a></li>
    <?php ?>
    There are various other things you can test for different situations, like $_SESSION['customer_id'] to tell if the customer is logged in (so you can show the login or logout link as appropriate).

  5. #5
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: is on-state look available for navigation?

    thanks. If I go that route (which seems like the best), how do I modify the links that go to ez-pages as well as product category pages? Here's the actual site to give you an idea what I mean:

    http://www.thepresidentscroogereport.com/

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

    Default Re: is on-state look available for navigation?

    Looks like fun!
    It would have been simpler to use the existing ez-page sidebox and footer menus, with ez-page internal links to lead to other pages, but now that you have it, you may as well keep it.

    Ez-page detection can be done like this
    PHP Code:
    if($current_page_base == 'page' and $_GET['id'] == 2){

    // <li> for Interview 

  7. #7
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: is on-state look available for navigation?

    That worked. Any idea how i can get this to work for categories? I have two categories, books and music, that have navigation items where I want to use the same effect. I tried using the ez-page code, but not sure what to replace "page" with (or whatever I need to change on that line).

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

    Default Re: is on-state look available for navigation?

    Which navigation items do you want to affect? That is necessary to know before we can answer you.

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

    Default Re: is on-state look available for navigation?

    Do you mean the same custom nav menus?
    PHP Code:
    if($current_page_base == 'index' and $cPath == 2){

    // <li> for Music 

  10. #10
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: is on-state look available for navigation?

    that sorta worked. One navigation item is going to a specific product in a category (cPath=1, ProductID=1). When you go to that product, the button isn't getting greyed out. Do I need to do something additonal to the code? I was hoping that just using the cPath would work. Here's the code below for that one and a link to the site:

    <ul id="navigation">
    <?php if($current_page_base == 'index' and $_GET['cPath'] == 1){ ?>
    <li id="nav_order" class="currentpage"><a href="http://www.thepresidentscroogereport.com/index.php?main_page=product_info&cPath=1&products_id=1"id="lastitem">Order</a></li>
    <?php }else{ ?>
    <li id="nav_order"><a href="http://www.thepresidentscroogereport.com/index.php?main_page=product_info&cPath=1&products_id=1"id="lastitem">Order</a></li>
    <?php } ?>
    </ul>


    site URL: http://www.thepresidentscroogereport.com

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 5 May 2016, 01:25 AM
  2. v151 Should TaxCloud be passing State Code or State name to TaxCloud for verification?
    By RCwebdev in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 9 Dec 2013, 10:16 PM
  3. Trying to add left navigation bar/ match ZenCart to the look of my site
    By NavPublishing in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 28 Oct 2008, 09:08 PM
  4. How can I change the look of the navigation side bar, to look like this
    By paha in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 12 Mar 2008, 04:45 AM
  5. Navigation button in the "active" state
    By kyates in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 23 Aug 2007, 12:35 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