Categrory links in catalog block

Posts: 8
Joined: 08/20/2007

Our product category structure look like this:

Catalog
--Menswear
----Jackets
----Pants
--Womenswear
----Blouse
----Skirts
--Kids
----Tees
----Shorts

We need help in disabling the link on Menswear, Womenswear, and Kids - reason being, our block menu is set to expand by default, users can go direct to individual categories such as Jackets, Pants, Blouse etc, there is no need to load the main category pages.

Please offer your price for making such modification.

Posts: 3744
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

So basically you don't want a link in that block to any category in the catalog that has subcategories? When you're browsing from the root of the catalog, I assume they should still display?

Posts: 66
Joined: 01/23/2008

I have a contribution here. http://www.ubercart.org/contrib/3202 . May be you have to check.

Posts: 8
Joined: 08/20/2007

This will help you understand better:
http://monicaquen.com.sg/

On the left: Menswear, Womenswear, Accessories should not be clickable.

There is no link to root of catalog, so it isn't much an issue. Then again, unless the user enters the URL directly, i.e. http://monicaquen.com.sg/catalog but I'm sure very few people would do that, if not none.

Posts: 86
Joined: 02/06/2008

I'd be interested in seeing the solution too.

Posts: 86
Joined: 02/06/2008
Posts: 66
Joined: 01/23/2008

I am not sure whether this helps. Please try.

Under your drupalPath\theme directory find your theme and add the following function to your templete.php file. If you do not have a templete.php you have to create one. And change the YOURTHEME with your theme. This avoids the link form expandable items.

<?php
function YOURTHEME_uc_catalog_item($here, $active_link = '', $lis, $expand, $inpath, $link, $count_children ){
 
$output='';

  if (
$expand || $count_children){
    if (
$here){
     
$output = '<li class="expanded"><strong>'. $active_link ."</strong>\n";
      if (
count($lis)){
       
$output .= '<ul class="menu">';
        foreach (
$lis as $li){
         
$output .= $li ."\n";
        }
       
$output .= "</ul>\n";
      }
     
$output .= "</li>";
    }
    elseif (
$expand || $inpath){
      if (
count($lis)) {
       
$mylink = substr($link,strpos($link, '">')+2);
       
$mylink = str_replace('</a>','',$mylink);
       
$output = '<li class="expanded">'. ($referer == $branch_path ? '<strong>' : '') . $mylink . ($referer == $branch_path ? '</strong>' : '') ."\n";
      }
      else {
       
$output = '<li class="expanded">'. ($referer == $branch_path ? '<strong>' : '') . $link . ($referer == $branch_path ? '</strong>' : '') ."\n";
      }
    
      if (
count($lis)){
       
$output .= '<ul class="menu">';
        foreach (
$lis as $li){
         
$output .= $li;
        }
       
$output .= "</ul>\n";
      }
     
$output .= "</li>";
    }
    else{
     
$output = '<li class="collapsed">'. $link ."</li>\n";
    }
  }
  else{
   
$output = '<li class="leaf">'. ($inpath ? '<strong>' : '') . ($here ? $active_link : $link) . ($inpath ? '</strong>' : '') .'</li>'. "\n";
  }

  return
$output;
}
?>