Jump to content

Showing Subcategories, Only On Level 2 Category Pages


samverdyck

Recommended Posts

I would like to modify the possibility of showing subcategories on a category page. 
I only want subcategories to be shown when on level 2 category. (and then the level-3 categories are shown)
 
I don't want level-2 subcategories on a level-1 category page. 
 
Someone has a starting point on achieving this?
 
Beneath the code that configures the subcategory layout in the category.tpl file.
 
thanks!
 

<!-- SUBCATEGORIES -->
		<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>

		{if isset($subcategories)}
		{if (isset($display_subcategories)) || !isset($display_subcategories) }
		<!-- Subcategories -->
		<div class="row">

				{foreach from=$subcategories item=subcategory}
					<div class="col-md-3 col-xs-6">
						<div class="subcategory-image">
							<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img">
							{if $subcategory.id_image}
								<img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html':'UTF-8'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
							{else}
								<img class="replace-2x" src="{$img_cat_dir}{$lang_iso}-default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
							{/if}
						</a>
						</div>
						<h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'}</a></h5>
						{if $subcategory.description}
							<div class="cat_desc">{$subcategory.description}</div>
						{/if}
					</div>
				{/foreach}
		</div>
		<br/>	
        {/if}
		{/if}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...