View Single Post
  #5  
Old 10-20-2008, 05:07 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: When Root Cat clicked display sub cat?

Quote:
Originally Posted by pepperlady
I'll test it out but I have to figure out where to place the code. They don't seem to specify where to place the smarty code.
Try change your skin1/customer/categories.tpl like this:
HTML Code:
{* $Id: categories.tpl,v 1.1.2.34 2008/05/26 07:35:16 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="fc_cellpadding" value="0"} {else} <table cellpadding="4" cellspacing="1"> {if $current_category.parentid ne 0}{assign var="curcat" value=$current_category.parentid}{/if} {if $curcat eq 0 }{assign var="curcat" value=$current_category.categoryid}{/if} {foreach from=$categories item=c} <tr> <td valign="top"><img src="{$ImagesDir}/category_bullet.gif" width="6" height="13" alt="" /></td> <td><a href="home.php?cat={$c.categoryid}" class="VertMenuItems"><font class="CategoriesList">{$c.category}</font></a></td> </tr> {if $altcategories and $c.categoryid eq $curcat} <tr><td colspan="2"><table cellpadding="0" cellspacing="0"> {foreach from=$altcategories item=v} <tr> <td valign="top" style="padding-left:15px;"><img src="{$ImagesDir}/category_bullet.gif" width="10" height="13" alt="" /></td> <td><a href="home.php?cat={$v.categoryid}" class="VertMenuItems"><font class="CategoriesList" style="font-size:10px;">{$v.category}</font></a></td> </tr> {/foreach} </table> {/if} {/foreach} </table> {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}


and add lines
PHP Code:
if ($current_category['parentid']>0){
 
$_where "parentid='$current_category[parentid]'";
} else {
 
$_where "parentid='$current_category[categoryid]'";
}
$altcategories func_query("SELECT * FROM $sql_tbl[categories] WHERE $_where ORDER BY $sql_tbl[categories].order_by, category");
$smarty->assign("altcategories"$altcategories); 
in include/categories.php right before
PHP Code:
if (!empty($subcategories))
    
$smarty->assign("subcategories"$subcategories);

$smarty->assign("cat"$cat); 

I have tested this on 4.1.11 and found no problem
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote