Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Nov 2006
    Posts
    73
    Plugin Contributions
    0

    Default Replacing Categories - Tabs Menu with Images

    My goal for today is to replace the standard text links on the categories-tabs menu with image links. Merlin's code HERE isn't ideal, as I need the category names to appear properly. Later in the same thread, GJH posts a method to do it, but only with the main tpl_categories file. I need the same thing, but with the categories-tabs menu.

    My current site is up at http://test.headsonic.com. Below the logo.gif is the navcattabs menu, where there are currently two links (my only two categories, Headphones and Microphones). In order to style these like what I want (see http://files.headsonic.com/files/1/finalwant.png for an example), I believe I need to hardwire the images into PHP, like in Glenn's solution.

    However, the PHP for the categories-tabs menu (seen in includes/templates/YOUR_TEMPLATE/templates) is pretty much indecipherable to me:
    PHP Code:
    <?php
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_CATEGORIES_TABS));

    ?>

    <?php if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) { ?>

    <div id="navCatTabsWrapper">

    <div id="navCatTabs">

    <ul>

    <?php for ($i=0$n=sizeof($links_list); $i<$n$i++) { ?>

      <li><?php echo $links_list[$i];?></li>

    <?php ?>

    </ul>

    </div>

    </div>

    <?php ?>
    The modules/categories_tabs.php is as such:
    PHP Code:
    <?php


    if (!defined('IS_ADMIN_FLAG')) {

      die(
    'Illegal Access');

    }

    $order_by " order by c.sort_order, cd.categories_name ";



    $categories_tab_query "select c.categories_id, cd.categories_name from " .

    TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd

                              where c.categories_id=cd.categories_id and c.parent_id= '0' and cd.language_id='" 
    . (int)$_SESSION['languages_id'] . "' and c.categories_status='1'" .

    $order_by;

    $categories_tab $db->Execute($categories_tab_query);



    $links_list = array();

    while (!
    $categories_tab->EOF) {



      
    // currently selected category

      
    if ((int)$cPath == $categories_tab->fields['categories_id']) {

        
    $new_style 'category-top';

        
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';

      } else {

        
    $new_style 'category-top';

        
    $categories_tab_current $categories_tab->fields['categories_name'];

      }



      
    // create link to top level category

      
    $links_list[] = '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' $categories_tab_current '</a> ';

      
    $categories_tab->MoveNext();

    }



    ?>

  2. #2
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    While I applaud you for tying to use the CatTabs for your layout, I would suggest just using regular linked images if you are only going to have 2 categories.
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Nov 2006
    Posts
    73
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Quote Originally Posted by Kim View Post
    While I applaud you for tying to use the CatTabs for your layout, I would suggest just using regular linked images if you are only going to have 2 categories.
    Fair enough! I'll see where that gets me this afternoon.

    Cheers.

  4. #4
    Join Date
    Nov 2006
    Posts
    73
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Quote Originally Posted by Kim View Post
    While I applaud you for tying to use the CatTabs for your layout, I would suggest just using regular linked images if you are only going to have 2 categories.
    Unfortunately, in my instance just adding it manually may not work. You see, I want the index to look like this, with the Headphones category already open (they are by far my dominant seller). To achieve this, I've just turned on "Categories - Always Show on Main Page" in the Admin Layout Settings. I can't see how I could then manually add the category headings, when no text is displayed.

    Secondly, CatTabs has a different stylesheet case built in if a category is selected. With that, I can put in my 'pink bracket' selector when a category is selected and open.

    If there is a way to achieve this with a static page, I'm all ears!

  5. #5
    Join Date
    Apr 2006
    Posts
    265
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Do you want the headphones and microphones categories images to appear on every page or just the index page?

    Either way, with only two categories it'd be a lot easier to hard-code it once. You could even check to see which category is currently selected and append it with the pink brackets.

    Pretty simple, actually. If you'll just clarify for me which you are trying to do, I'll try to walk you through doing it.

    BrandTim

  6. #6
    Join Date
    Nov 2006
    Posts
    73
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Quote Originally Posted by brandtim View Post
    Do you want the headphones and microphones categories images to appear on every page or just the index page?
    Every page, please. What I'd like to achieve is for the open main category (either Headphones or Microphones) to be at 100&#37; opacity with a pink bracket next to it, and for the category that is not active to have a 50% opacity image without the pink bracket, and for this to change to 100% opacity on hover.

    Hopefully THIS image gives you more of a clue as to what I'm on about (ignore the darker specials box on the right side, I'll add that later).

  7. #7
    Join Date
    Apr 2006
    Posts
    265
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Ok - change your includes/templates/wogeordie/templates/tpl_modules_categories_tabs.php to this:

    Code:
    <div id="navCatTabsWrapper">
    <div id="navCatTabs">
    
    <?php if ((int)$cPath != 2) { ?>
    
      <a href="<?php echo zen_href_link(FILENAME_DEFAULT, 'cPath=1') ?>"><img src="headphones_100_perc.jpg" alt="headphones category" /> <span class="pink_braces">]]]</span></a>
      <br class="clearBoth" />
      <a href="<?php echo zen_href_link(FILENAME_DEFAULT, 'cPath=2') ?>"><img src="microphones_50_perc.jpg" alt="microphones category" onmouseover="this.src='microphones_100_perc.jpg'" onmouseout="this.src='microphones_50_perc.jpg' /></a>
      
    <?php } else { ?>
    
      <a href="<?php echo zen_href_link(FILENAME_DEFAULT, 'cPath=1') ?>"><img src="headphones_50_perc.jpg" alt="headphones category" onmouseover="this.src='headphones_100_perc.jpg'" onmouseout="this.src='headphones_50_perc.jpg' /></a>
      <br class="clearBoth" />
      <a href="<?php echo zen_href_link(FILENAME_DEFAULT, 'cPath=2') ?>"><img src="microphones_100_perc.jpg" alt="microphones category" /> <span class="pink_braces">]]]</span></a>
      
    <?php } ?>
    
    </div>
    </div>
    <?php } ?>
    Brief explanation:

    The "if ((int)$cPath != 2)" line checks to see which category (if any) is selected and load the appropriate image set based on that. The pink brackets are also appended to the currently selected category.

    The onmouseover and onmouseout events switch the images between 50% and 100%.


    Just be sure you get all of the image src files in this code correct to your image source files. You'll also need to style the images and the pink brackets.

    BrandTim

  8. #8
    Join Date
    Nov 2006
    Posts
    73
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Quote Originally Posted by brandtim View Post
    The "if ((int)$cPath != 2)" line checks to see which category (if any) is selected and load the appropriate image set based on that. The pink brackets are also appended to the currently selected category.

    The onmouseover and onmouseout events switch the images between 50&#37; and 100%.
    Brilliant. Utterly brilliant. With a bit of fiddling, I got them working absolutely perfectly.

    Thankyou so much, you've been a fantastic help. I'm one massive step closer to done now.

    Really appreciated.

    Results: http://test.headsonic.com

  9. #9
    Join Date
    Apr 2006
    Posts
    265
    Plugin Contributions
    0

    Default Re: Replacing Categories - Tabs Menu with Images

    Sweet. That looks really good. Glad I could help.

    The more happy ZenCart site owners the better I always say.

    BrandTim

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

    Default Re: Replacing Categories - Tabs Menu with Images

    Looking good! Now just eliminate the "Heading 1" text from the cases and your titles will be done.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v1371 Problem with the Categories-Tabs Menu
    By Tjekija in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 29 Feb 2012, 01:07 PM
  2. Replacing Categories sidebar with images
    By teraysay in forum Basic Configuration
    Replies: 2
    Last Post: 2 Mar 2009, 08:02 PM
  3. Categories-Tabs Menu
    By PGlad in forum Customization from the Admin
    Replies: 2
    Last Post: 27 Jun 2007, 04:01 PM
  4. Categories-Tabs Menu
    By GouldRoss in forum General Questions
    Replies: 3
    Last Post: 10 Apr 2007, 08:10 AM

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