X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   When Root Cat clicked display sub cat? (https://forum.x-cart.com/showthread.php?t=43052)

pepperlady 10-16-2008 06:10 PM

When Root Cat clicked display sub cat?
 
Solved by Victor D in post #5 (Works in 4.1.11 confirmed)

How would I get my categories to display sub categories when they've been clicked. For example

____________________________
All Products
Shop By Brand (clicked)
------------------------
Kick Butt
Catsup
Lizards and Gutts

Shop By Price
Shop By Category
____________________________

Victor D 10-17-2008 02:56 AM

Re: When Root Cat clicked display sub cat?
 
Like this?
http://forum.x-cart.com/showthread.php?t=3242&highlight=subcategories

balinor 10-17-2008 02:56 AM

Re: When Root Cat clicked display sub cat?
 
You mean in the side menu? Try one of these:

http://www.xcartmods.co.uk/navigation-x-cart-mods-c-3.html

pepperlady 10-17-2008 09:37 AM

Re: When Root Cat clicked display sub cat?
 
Quote:

Originally Posted by Victor D


Yes that's what I want but does it work for 4.1.11? I saw the last post in that thread and someone said they can't get it to work for 4.1.7

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.

Victor D 10-20-2008 05:07 AM

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

pepperlady 10-21-2008 04:55 PM

Re: When Root Cat clicked display sub cat?
 
Excellent! Thank you very much!

komarik 10-25-2008 02:38 PM

Re: When Root Cat clicked display sub cat?
 
Thanks for the script... but now I want to have current Category/subcategory to be highlighted or active.

Please advice.
Thanks

pepperlady 10-25-2008 10:09 PM

Re: When Root Cat clicked display sub cat?
 
Quote:

Originally Posted by komarik
Thanks for the script... but now I want to have current Category/subcategory to be highlighted or active.

Please advice.
Thanks

That requires you to go to skin1.css and change the active:link code
It's a style sheet thing, it's simple. It'll highlight the current page you're on with whatever text decoration you want for example

a:active {
text-decoration: underline;
font-weight: bold;
}

Will look like this when active

Category 1
Category 2
-Sub
-sub2
Category 3

komarik 10-25-2008 10:28 PM

Re: When Root Cat clicked display sub cat?
 
Hey Pepperlady,

Thanks for the reply, but it doesn't work. It does work for Active state on the links, but it doesn't highlight the current category. What I need is to show current category in different color.

Cat 1
Cat 2
- Sub Cat 1
- Sub Cat 2
- Sub Cat 3 (Current)
- Sub Cat 4
Cat3

Thanks,
Nikolay

pepperlady 10-26-2008 12:12 AM

Re: When Root Cat clicked display sub cat?
 
So you mean it needs to look literally like this

cat1
cat2
-sub1
-sub2
-sub3
cat3

and red meaning it's the active sub link?
or do you want it highlighted as in a box appears around it when active?

Should still work with a: active

You'll have to find out the exact css class for the sub cat if it doesn't work. Then apply my method to it.


All times are GMT -8. The time now is 05:33 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.