Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Hide link in navigation bar.

Hide link in navigation bar.

Views: 2,269

Results 1 to 19 of 19
17 Nov 2012, 7:55 PM
#1
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Hide link in navigation bar.

I am trying to display most top category links in the top navigation bar but hide 5 of them. Then in my left hand navigation box display (Better Categories) I want to hide the opposite categories.

Please look at my template here: http://www.lasilhouettelingerie.com/store/hosiery-c-141/?page=2&sort=20a

My main categories are:
Pleasure Objects, Hosiery, Accessories, Clothing, Lingerie, Swimwear, Sale, Shop by Category, Shop by Designer, Shop by Price, Shop by Color, Shop by Size

On the top menu I want to hide all "shop by" menu items. Meaning my top category display would only show:
Pleasure Objects, Hosiery, Accessories, Clothing, Lingerie, Swimwear, Sale

On the left hand navigation block I want to display only these other 5 main categories:
Shop by Category, Shop by Designer, Shop by Price, Shop by Color, Shop by Size

I tried to install a module called: Hidden Categories (even though it was for version 1.3.9) to hide aspects of one of these menus, but it ran into difficulty with merging since this shared many of my files with my other plugins. Like: Ultimate SEO's, FEC, and My template files. There were too many files to merge and my PHP was getting jumbled. (I don't know much about PHP to begin with).

Any ideas?

17 Nov 2012, 8:17 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

http://www.zen-cart.com/showthread.php?201898-Hide-single-category-tab

I do have the files made up for a mod, but have not tested the package yet. If you want, I can zip them up and post for you to try.

To hide the other categories in the sidebox, you can use Categories Dressing and make the ones you want to hide into one or more category groups, then hide those with CSS.

17 Nov 2012, 10:10 PM
#3
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Yes I think I would love the files for that mod please. I will test it to see if it works. Although, I may not be the best tester because I will just put it up there and see if it hides and/or shows. I know nothing about debugging.

I thought that I could just put the EZ page menu up top (like I have on the bottom) and just manually create each catalog link using the URL feature in EZ pages to direct to the correct page. The problem with this, is that I would like to put a dynamic menu up there to show all the subcategories when hovered over. So if I can hide these few links, then I will search out the dynamic menu I am seeking.

In the meantime, I am going to attempt your suggestions for hiding the side categories via Categories Dressing plugin.

18 Nov 2012, 1:41 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

I attached the mod to the thread referenced before, so you can get it from there. It will not hide anything just by itself; you need to add rules to your stylesheet (duplicating/editing the ones given) to do the hiding for the particular categories.

18 Nov 2012, 5:30 AM
#5
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Thank you I posted in the forum with the Mod providing feedback. It's running great!

19 Nov 2012, 2:26 AM
#6
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

gjh42,

First you done a wonderful job on this module you provided. I am sorry to bring this up, but I thought I would ask. What I am talking about is, if possible, I would like to implement your: "Category Tab Dressing v10 - Beta" into "Category Tab Simple Dropdown Menu v.1.3.9a" Since there were only a few files for both (and one of them shared), I thought I might be able to do this easily.

I tried many things, but I do not know php. What I ended up with was merging the shared files together into one page, in an effort to get the dynamic drop down menu and hide the 5 "shop by" categories. It doesn't seem to be working for me.

Right now I have both menus loaded onto my site you can see it here: http://www.lasilhouettelingerie.com/store/hosiery-c-141/ I really love the dynamic drop-down, but I also have to hide 5 categories somehow.

Is there a fairly simple merge possible?

19 Nov 2012, 3:51 PM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

It should be simple, as there are only about three lines in two files modified for this. Which file do they share?

19 Nov 2012, 4:23 PM
#8
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

gjh42:

It should be simple, as there are only about three lines in two files modified for this. Which file do they share?

They both share tpl_modules_categories_tabs.php in the ../templates/MYTEMPLATE/templates folder. Below I have posted both shared files (tpl_categories_tabs.php) for the prospective plugins.

As you know, in the module: "Category Tab Dressing v10 - Beta" you created this code which hides the links:

<?php
/**
 * Module Template - categories_tabs
 *
 * Template stub used to display categories-tabs output
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_categories_tabs.php 3395 2006-04-08 21:13:00Z ajeh $
 * modified for Categories-Tabs Dressing by Glenn Herbert (gjh42) 2012-11-09  (line 22)
 */

  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 class="<?php echo substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23));?>"><?php echo $links_list[$i];?></li>
<?php } ?>
</ul>
</div>
</div>
<?php } ?>

And in the module: "Category Tab Simple Dropdown Menu v.1.3.9a" we have this code which provides the dynamic drop-down menus (and a few css definitions elsewhere):

<?php
/**
 * Module Template - categories_tabs with dropdown product menus
 *
 * Template stub used to display categories-tabs output
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_categories_tabs.php 3395 2011-06-10 21:13:00Z dbltoe $
 */
?>
<?php
if (CATEGORIES_TABS_STATUS == '1') 
{
    echo '<div id="navCatTabsWrapper">';
    echo '<div id="navCatTabsDropdown">';
    echo '<ul>';

    $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 c.sort_order, cd.categories_name;";
    $categories_tab = $db->Execute($categories_tab_query);

    while (!$categories_tab->EOF) 
    {
    // currently selected category
        echo '<li>';
        echo '<a class="category-top" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">'; 
        if((int)$cPath == $categories_tab->fields['categories_id']) 
         echo '<span class="category-subs-selected">'.$categories_tab->fields['categories_name'].'</span>';
        else 
         echo $categories_tab->fields['categories_name'];

        echo '</a>';
        $subcategories_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= '".(int)$categories_tab->fields['categories_id']."' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name;";
        $subcategories_tab=$db->Execute($subcategories_tab_query);
        if($subcategories_tab->RecordCount()>0)
        {
            echo '<ul>';
            while (!$subcategories_tab->EOF) 
            {
                $cPath_new=zen_get_path($subcategories_tab->fields['categories_id']);
                $cPath_new=str_replace('=0_', '=', $cPath_new);
                $cPath_new="cPath=".$subcategories_tab->fields['categories_id'];
                echo '<li>'.'<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">'.$subcategories_tab->fields['categories_name'].'</a></li>';
                $subcategories_tab->MoveNext();
            }
            echo '</ul>';
        }
        $products_tab_query="SELECT p.`products_id`, pd.`products_name`, pd.`language_id` FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE p.`master_categories_id`='".(int)$categories_tab->fields['categories_id']."' AND p.`products_id`=pd.`products_id` AND p.products_status='1' AND pd.`language_id`='".(int)$_SESSION['languages_id']."' ORDER BY p.`products_sort_order`;";
        $products_tab=$db->Execute($products_tab_query);
        if($products_tab->RecordCount()>0)
        {
            echo '<ul>';
            while (!$products_tab->EOF) 
            {    
                $cPath_new=zen_get_path($categories->fields['categories_id']);
                $cPath_new=str_replace('=0_', '=', $cPath_new);
                echo '<li>'.'<a href="'.zen_href_link(zen_get_info_page($products_tab->fields['products_id']),$cPath_new. '&products_id=' . $products_tab->fields['products_id']) . '">'.$products_tab->fields['products_name'].'</a></li>';
                $products_tab->MoveNext();
            }
            echo '</ul>';
        }
        echo '</li>';
        $categories_tab->MoveNext();
    }
    echo '</ul>';
    echo '</div>';
    echo '</div>';
}
?>

I tried to merge both files by putting all the code, but both menus showed instead of a merge. As you know the: "Category Tab Dressing v10 - Beta" also has the includes/modules/MYTEMPLATE/categories_tabs.php file as well. If this can be done it would be awesome!

19 Nov 2012, 6:07 PM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

<li class="<?php echo substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23));?>"><?php echo $links_list[$i];?></li> This part of the simple dropdown file needs to be edited to add the class tag to the <li>: ```php while (!$categories_tab->EOF) { // currently selected category echo '<li>'; ``` ```php while (!$categories_tab->EOF) { // currently selected category echo '<li class="<?php echo substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23));?>">'; ``` This should work as long as the simple dropdown does not alter how $links_list is built, and lets the cat-tabs dressing do it.
19 Nov 2012, 10:38 PM
#10
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Glen please forgive me for being ignorant, I am getting many PHP syntax errors in dreamweaver.

In my dynamic drop-down file, I took this code:

while (!$categories_tab->EOF) 
    {
    // currently selected category
        echo '<li>';

and changed it to this:

while (!$categories_tab->EOF)  
    { 
    // currently selected category 
        echo '<li class="<?php echo substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23));?>">';

as you suggested. But almost every other line below this registered errors in Dreamweaver.

Now with the next few lines it looks like this:

while (!$categories_tab->EOF) 
    {
    // currently selected category
        echo '<li class="<?php echo substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23));?>">';
        echo '<a class="category-top" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">'; 
        if((int)$cPath == $categories_tab->fields['categories_id']) 
         echo '<span class="category-subs-selected">'.$categories_tab->fields['categories_name'].'</span>';
        else 
         echo $categories_tab->fields['categories_name'];

        echo '</a>';

Is there an issue with syntax above? There are approximately 20 lines below this now with red error coding. I don't know my symbols but I suspect one of the symbols above may be wrong?

20 Nov 2012, 5:11 AM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

It's possible that Dreamweaver is choking on the second " within the strpos syntax. The actual reason for issues is that I didn't completely translate the whole line's syntax for its new context, within PHP code rather than HTML code.```php
echo '<li class="<?php echo substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23));?>">';

should really be
```php
        echo '<li class="' . substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23)) . '">';
20 Nov 2012, 6:39 AM
#12
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Glen, thank you the coding did plug in. At first I was getting definitions like this: <li class=""> for all my categories. Then I realized I need to add one line of code from your page to the dynamic drop-down page. That coding was this:

include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORIES_TABS));

Now I am getting li class numbers for all the top categories. Here is a sampling of the code it spat out:

<!--bof-optional categories tabs navigation display-->
<div id="navCatTabsWrapper">
    <div id="navCatTabsDropdown">
        <ul>
            <li class="cat141">
            <a class="category-top" href="http://www.lasilhouettelingerie.com/store/pleasure-objects-c-181.html">
            <span class="category-subs-selected">Pleasure Objects</span></a><ul>
                <li>
                <a href="http://www.lasilhouettelingerie.com/store/lelo-ina-a-fully-dual-action-vibrator-p-1755.html">
                LELO Ina A Fully Dual Action Vibrator</a></li>
            </ul>
            </li>
            <li class="cat141">
            <a class="category-top" href="http://www.lasilhouettelingerie.com/store/hosiery-c-141.html">
            Hosiery</a></li>
            <li class="cat141">
            <a class="category-top" href="http://www.lasilhouettelingerie.com/store/accessories-c-193.html">
            Accessories</a><ul>

This is the class I am getting for all the master categories: <li class="cat141"> And it's the same on all the master category pages.
All sub-category pages spit out: <li class="cat193">.
Home page plus informational pages spit out: <li class="cat181">

So it seems to be working, but it's not giving one page individual categories. Instead it seems to be giving one class id for the entire page, depending on which page you are on.

Then I noticed a few differences between your file and the dynamic drop-down file.
Dynamic Drop-down had this:

if (CATEGORIES_TABS_STATUS == '1')

I changed to this:

if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) 

and this line was missing from the file as well:

for ($i=0, $n=sizeof($links_list); $i<$n; $i++)

This line above made a difference, but it is in the wrong place. I can see it giving different numbers now, so I think I am very close.

My file looks like this now:

<?php
/**
 * Module Template - categories_tabs with dropdown product menus
 *
 * Template stub used to display categories-tabs output
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_categories_tabs.php 3395 2011-06-10 21:13:00Z dbltoe $
 */
[B]include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORIES_TABS));[/B]
?>
    
<?php
if (CATEGORIES_TABS_STATUS == '1'[B] && sizeof($links_list) >= 1[/B]) 
{
    echo '<div id="navCatTabsWrapper">';
    echo '<div id="navCatTabsDropdown">';
    echo '<ul>';

    $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 c.sort_order, cd.categories_name;";
    $categories_tab = $db->Execute($categories_tab_query);

    while (!$categories_tab->EOF) 
    {
    // currently selected category
        [B]for ($i=0, $n=sizeof($links_list); $i<$n; $i++)[/B]
        [B]echo '<li class="' . substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23)) . '">';[/B]
        echo '<a class="category-top" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">'; 
        if((int)$cPath == $categories_tab->fields['categories_id']) 
         echo '<span class="category-subs-selected">'.$categories_tab->fields['categories_name'].'</span>';
        else 
         echo $categories_tab->fields['categories_name'];

and the website is spitting out numbers like this:

<!--bof-optional categories tabs navigation display-->
<div id="navCatTabsWrapper">
    <div id="navCatTabsDropdown">
        <ul>
            <li class="cat181"></li>
            <li class="cat141"></li>
            <li class="cat193"></li>
            <li class="cat190"></li>
            <li class="cat191"></li>
            <li class="cat192"></li>
            <li class="cat71"></li>
            <li class="cat72"></li>
            <li class="cat82"></li>
            <li class="cat189"></li>
            <li class="cat90">
            <a class="category-top" href="http://www.lasilhouettelingerie.com/store/pleasure-objects-c-181.html">
            Pleasure Objects</a><ul>
                <li>
                <a href="http://www.lasilhouettelingerie.com/store/lelo-ina-a-fully-dual-action-vibrator-p-1755.html">
                LELO Ina A Fully Dual Action Vibrator</a></li>
            </ul>
            </li>
            <li class="cat181"></li>
            <li class="cat141"></li>
            <li class="cat193"></li>
            <li class="cat190"></li>
            <li class="cat191"></li>
            <li class="cat192"></li>
            <li class="cat71"></li>
            <li class="cat72"></li>
            <li class="cat82"></li>
            <li class="cat189"></li>
            <li class="cat90">
            <a class="category-top" href="http://www.lasilhouettelingerie.com/store/hosiery-c-141.html">
            Hosiery</a></li>
            <li class="cat181"></li>
            <li class="cat141"></li>
            <li class="cat193"></li>
            <li class="cat190"></li>
            <li class="cat191"></li>
            <li class="cat192"></li>
            <li class="cat71"></li>
            <li class="cat72"></li>
            <li class="cat82"></li>
            <li class="cat189"></li>
            <li class="cat90">
            <a class="category-top" href="http://www.lasilhouettelingerie.com/store/accessories-c-193.html">
            Accessories</a><ul>

I am thinking I am close because it is numbering. It's just that the numbering is in the wrong place according to this code. So I didn't have the 2 files (and still don't) merged correctly.

21 Nov 2012, 10:27 PM
#13
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

OK, I think I may be very close. Please note: that this is pure speculation only :)

If I have this code:

echo '<a class="[categories_id]" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">'; 

Where:

[categories_id]

What type of code would I use here to pull up the category id into the output? If I can get this to pull up the category ID of the page in that area, it will output the category ID as the class. Therefore, I can style it in the stylesheet and hide this class. Please note I am not good at all in PHP. So I don't know opening and closing characters, and how they would affect the rest of the line (if there are such terms for PHP).

21 Nov 2012, 11:10 PM
#14
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

Just add the whole reference to the cat id: $categories_tab->fields['categories_id']
You also need a bit of static text so the class isn't just a number.```php
echo '<a class="cat' . $categories_tab->fields['categories_id'] . '" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">';

22 Nov 2012, 12:00 AM
#15
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Yaaaaaahhhhh... It works! First things first: Glenn is awesome!

If anyone else wants to combine these 2 modules, it can be done and you can hide main categories in the dropdown menu plugin. Perhaps one day this file will be an option for the Category Tab Simple Dropdown Menu v.1.3.9a.

This does hide main categories. I suppose if anyone wants to modify the sub-categories in the future you might be able to hide these as well. The code I would guess you would have to modify would be marked in blue text below. My working copy only adds classes to the categories, not the drop-down subcategories.

This is the new tpl_modules_categories_tabs merged file code. Once again use this if you want the "Category Tab Simple Dropdown Menu v.1.3.9a" plugin and want to hide any of the main category links. Then make the modifications below. Items in red areas are add-ons or modifications from the original file.

<?php
/**
 * Module Template - categories_tabs with dropdown product menus
 *
 * Template stub used to display categories-tabs output
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_categories_tabs.php 3395 2011-06-10 21:13:00Z dbltoe $
 */
include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORIES_TABS));
?>
    
<?php
if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) 
{
    echo '<div id="navCatTabsWrapper">';
    echo '<div id="navCatTabsDropdown">';
    echo '<ul>';

    $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 c.sort_order, cd.categories_name;";
    $categories_tab = $db->Execute($categories_tab_query);

    while (!$categories_tab->EOF) 
    {
    // currently selected category
        echo '<li class="' . substr($links_list[$i], 23, (strpos($links_list[$i], '" hr', $links_list[$i]) - 23)) . '">';
        echo '<a class="cat' . $categories_tab->fields['categories_id'] . '" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">'; 
        if((int)$cPath == $categories_tab->fields['categories_id']) 
         echo '<span class="category-subs-selected">'.$categories_tab->fields['categories_name'].'</span>';
        else 
         echo $categories_tab->fields['categories_name'];

        echo '</a>';
        $subcategories_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= '".(int)$categories_tab->fields['categories_id']."' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name;";
        $subcategories_tab=$db->Execute($subcategories_tab_query);
        if($subcategories_tab->RecordCount()>0)
        {
            echo '<ul>';
            while (!$subcategories_tab->EOF) 
            {
                $cPath_new=zen_get_path($subcategories_tab->fields['categories_id']);
                $cPath_new=str_replace('=0_', '=', $cPath_new);
                $cPath_new="cPath=".$subcategories_tab->fields['categories_id'];
                echo '<li>'.'<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">'.$subcategories_tab->fields['categories_name'].'</a></li>';
                $subcategories_tab->MoveNext();
            }
            echo '</ul>';
        }
        $products_tab_query="SELECT p.`products_id`, pd.`products_name`, pd.`language_id` FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE p.`master_categories_id`='".(int)$categories_tab->fields['categories_id']."' AND p.`products_id`=pd.`products_id` AND p.products_status='1' AND pd.`language_id`='".(int)$_SESSION['languages_id']."' ORDER BY p.`products_sort_order`;";
        $products_tab=$db->Execute($products_tab_query);
        if($products_tab->RecordCount()>0)
        {
            echo '<ul>';
            while (!$products_tab->EOF) 
            {    
                $cPath_new=zen_get_path($categories->fields['categories_id']);
                $cPath_new=str_replace('=0_', '=', $cPath_new);
                echo '<li>'.'<a href="'.zen_href_link(zen_get_info_page($products_tab->fields['products_id']),$cPath_new. '&products_id=' . $products_tab->fields['products_id']) . '">'.$products_tab->fields['products_name'].'</a></li>';
                $products_tab->MoveNext();
            }
            echo '</ul>';
        }
        echo '</li>';
        $categories_tab->MoveNext();
    }
    echo '</ul>';
    echo '</div>';
    echo '</div>';
}
?>

Now in your css add this to hide the main categories you wish to hide:

.cat16 {display: none;}
.cat36 {display: none;}
.cat181 {display: none;}
.cat43 {display: none;}

replace the numbers I have above, with your own category numbers in which you would like to hide. And your category links you want hidden will disappear!

Thank you Glenn!!!

23 Nov 2012, 4:10 AM
#16
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide link in navigation bar.

Looking at the code for this file in the dropdown mod, I can see that the alteration can be simplified considerably. The dropdown uses an object to hold all the information and output the parts where required, so $links_list is not needed, nor presumably is the call to include the categories_tabs.php module file. $categories_tab->fields['categories_id'] makes the category id available in the tpl_ file. If the <li> has the class tag, the <a> inside it doesn't need a class and its code can be dropped:```php
// currently selected category
echo '<li class="cat' . $categories_tab->fields['categories_id'] . '">';
echo '<a href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">';

7 Dec 2012, 5:36 PM
#17
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Glen,

I have a question and I think it could be a simple fix. I am asking here because your modifications helped me fine tune this plugin (Category Tab Simple Dropdown Menu 1.3.9). Is it possible to hide all the products from showing in the drop-down? (via .css or .php) I would only like for the sub-categories to display in the drop-down and not the products themselves.

7 Dec 2012, 6:09 PM
#19
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Hide link in navigation bar.

Will do. Thank you.