Jump to content

Adding subcategories of the categories shown in category.tpl


Recommended Posts

Hello,

 

When browsing a category, I want to display the subcategories of the browsed category and the next level of subcategories in unordered list.

 

Browsing category A will give

 

Subcategory A.1

- Subcategory A.1.1

- Subcategory A.1.2

- Subcategory A.1.3

 

Subcategory A.2

- Subcategory A.2.1

- Subcategory A.2.2

- Subcategory A.2.3

 

I was trying to make a loop in the existing loop of the file category.tpl but it doesn't work, I need the syntaxe or the variable which contains the subcategories. I don't know if this exists or not? I don't find any documentation on that topic.

 

In category.tpl we have:

 

	   	 {foreach from=$subcategories item=subcategory}
			<li>
				<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
					{if $subcategory.id_image}
						<img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
					{else}
						<img src="{$img_cat_dir}default-medium.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
					{/if}
				</a><br />
				<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>

			</li>
		{/foreach}

 

I need the variable, like $subcategories, which contains the subsubcategories or maybe I'm looking in the wrong direction?

 

And after with the same logic I want to show all the categories and subcategories in the footer..

 

Any help is appreciated

Link to comment
Share on other sites

Hello Mike,

 

Thanks for your suggestion, I have already tried this Module, but it's not really what I want. Basicly I just want to modify the category.tpl to display the subcategories of the subcategories displayed in the category.

 

Thanks.

Link to comment
Share on other sites

  • 5 weeks later...
  • 9 months later...
  • 10 months later...
  • 2 years later...

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...