Get Help/Forums/Design Tips & Tricks

Show sub category on product results page

gmac
posted this on December 08, 2011 10:28

Hi,

I have 3 levels of categories. 

2 of which show up in the category menu on the left. When someone clicks on a 2nd level category, I want its child categories (3rd level) to show up at the top of the results page, like a filter. 

I tried this code, but it doesn't work:

 

{{ #foreach ( $category in $methods.getcategoriesbyparentid($currentcategoryid)) }}
              <li>
                <href="{{ $category.categorylink }}?pagesize=40"><h3>{{ $category.name }}</h3></a>

                </ul>
                {{ #end }}
              </li>

If i replace {{ $currentcategoryid }} with the category number, it works fine. But this is no good as I want it to display the child categories of the current category being view, not a set a category.

The funny thing is if I print   {{ $currentcategoryid }} onto the page it will give me the category number. But it doesn't work inside the for statement. 

Any ideas?

Thanks a lot!

G