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)
-   -   Can someone look at my categories.tpl code? (https://forum.x-cart.com/showthread.php?t=46158)

DanUK 03-10-2009 05:10 AM

Can someone look at my categories.tpl code?
 
Hi,

I'm on X-Cart 4.0.12.

I'm trying to get the categories.tpl menu to show all subcategories below the main category.

I've worked out that I am not using the official 4.0.12 categories.tpl because the code is different and I suspect it's because it was an upgrade that Qualiteam did from an earlier store. If it ain't broke, don't fix it! :)

Anyway, by reading through the various hacks I've come up with this in my categories.tpl code, which displays the subcategories for the main category you happen to be in. However, I actually want it to display all subcategories under the main categories all the time.

Quote:

{section name=cat_num loop=$categories}
<font class=CategoriesList><a href="home.php?cat={ $categories[cat_num].categoryid }" class=VertMenuItems>{$categories[cat_num].category}</a></font>

{if $cat eq $categories[cat_num].categoryid || $current_category.parentid eq $categories[cat_num].categoryid}
{section name=subcat_num loop=$subcategories}

<font class=CategoriesList><a href="home.php?cat={ $subcategories[subcat_num].categoryid }"> { $subcategories[subcat_num].category|escape }</a></font>

{/section}
{/if}

{/section}



I'm having a hell of a time getting this to happen as I've been trying in vain to use this type of code from other hacks for my version:

Quote:

{section name=subcat loop=$allcategories}
{if $allcategories[subcat].parentid eq $categories[cat_num].categoryid}
{$allcategories[subcat].category}

{/if}
{/section}


but all I seem to get is a not hyperlinked list of categories. Can anyone help?

Thanks

Dan

JWait 03-17-2009 07:55 AM

Re: Can someone look at my categories.tpl code?
 
In your first example you have
<a href="home.php?cat={ $categories[cat_num].categoryid }" class=VertMenuItems>{$categories[cat_num].category}</a>
which is the hyperlink. It is missing from your 2nd example.


All times are GMT -8. The time now is 06:39 AM.

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