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)
-   -   Subcategory drop-down per Category Page (https://forum.x-cart.com/showthread.php?t=46802)

vikeny 04-06-2009 09:41 PM

Subcategory drop-down per Category Page
 
Hello,

I've been scouring these pages for the last hour. A variant of this question has been asked and answered in various degrees but a answer to this one simple mod has been surprisingly hard to find.

It's simple really: For any category page, display a drop-down menu/selector that is populated with the 1st level sub-categories of the parent category page.

I'd appreciate any help - a push in the right direction, perhaps a link to a third-party product.

The site I need this mod for runs X-Cart v. 4.1.8

Many thanks,
vik

mudebate 04-09-2009 01:36 PM

Re: Subcategory drop-down per Category Page
 
There was a thread where someone else shared how to do this. It looked something like this:

Quote:

{capture name=menu}
{if $active_modules.Fancy_Categories}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="additional_class" value="menu-fancy-categories-list"}
{else}
{assign var=thiscat value=$cat}
{assign var=par value=0}
{foreach from=$categories item=cats}
{assign var=Mcatid value=$cats.categoryid}
{foreach from=$allsubcategories.$Mcatid item=subb}
{if $subb.categoryid eq $thiscat}
{assign var=par value=$subb.parentid}
{/if}
{/foreach}
{/foreach}
<ul>
{foreach from=$categories_menu_list item=c}
<li><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category}</a></li>
{if $c.categoryid eq $par}
{foreach from=$allsubcategories.$par item=sub}
{if $sub.parentid eq $c.categoryid}
<a href="home.php?cat={$sub.categoryid}" class="subMenuItem">{$sub.category}</a>
{/if}
{/foreach}
{/if}
{foreach from=$allcategories item=cat}
{if $cat.parentid eq $c.categoryid}
<a href="home.php?cat={$cat.categoryid}" class="subMenuItem">{$cat.category}</a>
{/if}
{/foreach}
{/foreach}
</ul>
{assign var="additional_class" value="menu-categories-list"}
{/if}
{/capture}
{include file="customer/menu_.tpl" title=$lng.lbl_categories content=$smarty.capture.menu}





All times are GMT -8. The time now is 12:27 PM.

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