First I want to say thanks html_sucks for this original code
http://forum.x-cart.com/viewtopic.php?t=14905&highlight=subcategories
I made a few changes using his code in order to display subcategories on top of the menu.
Here what is looks like:
Home page menu display
----------------------
- Books
- CD - DVD - Video
----------------------
// 1st tier
When you click on books, the menu changes to
----------------------
Categories in this section are:
Internet (6)
Software (4)
- Books
Internet (6)
Software (4)
- CD - DVD - Video
----------------------
// 2nd tier
But when I click on the Internet section of the subcategory, the menu changes back to
----------------------
- Books
- CD - DVD - Video
----------------------
// 3rd tier
I think X-cart uses {parentid} to display for the 1st and 2nd tiers and then uses {categoryid} for the 3rd tier.
They did this so that the 3rd tier would have a default category by its own.
for example.
Your Company Name :: Books :: Internet :: PHP book
{parentid} {parentid} {categoryid} {categoryid}
You can click on Internet and see a list of PHP books.
It's when I click on the 3rd tier, this code doesn't function.
Please help!
Here is the code:
In my categories.tpl
Code:
{capture name=menu}
{section name=cat_num loop=$subcategories}
{if $subcategories[cat_num].product_count eq "0" }
<a href="home.php?cat={ $subcategories[cat_num].categoryid }" class="ProductTitle">
{ $subcategories[cat_num].category|escape }</a>
{elseif $subcategories[cat_num].subcategory_count gte "0"}
<a href="home.php?cat={ $subcategories[cat_num].categoryid }" class="ProductTitle">
{ $subcategories[cat_num].category|escape }</a>
({$subcategories[cat_num].product_count})
{/if}
{/section}