Jump to content

list of subcategories using parent id


Stella_Geo

Recommended Posts

without modification of front controllers it will not be possible

if you want to create it in index.tpl file you will need to modify indexController.php

you will have to create code there to attach category tree to smarty array

and then - display array as a category tree in index.tpl file

 

you can use the same way of how standard blockcategories module works.

Link to comment
Share on other sites

Thank you for your answer Vekia. 

 

To be honest, I think that's  as complicated as it is to create a module. I was hoping there was a simpler solution out of the box.

Anyway, I'll try to do it.

If I get it right,you suggest I should combine getTree function and the query from  hookLeftColumn function and then create a new tpl to display my results.

 

 

Although, while I was trying to find a simpler solution I managed to get a list of top-level categories using the following code

{foreach from=$categories item=child}
<li>
<a href="{$link->getCategoryLink({$child.id_category})}" title="{$child.name}">
{$child.name}
</a>
</li>
{/foreach}

and I'm searching for a way to show also subcategories and narrow results to only one parent category (using its ID)


I suppose that this is NOT the proper way to do what I'm describing above, but given the exact requirements of my project, I don't see another option.  All I need is to list the subcategories of a given category and avoid creating the links manually.

If anyone have an idea or an advice, I'll be happy to hear it 

 

 


 

Edited by Stella_geo (see edit history)
  • Like 1
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...