Jump to content

List of sub-categories on home?


Mike Goodstadt

Recommended Posts

Hi all,

 

I am writing carousel and slider modules which use categories rather than products.

I need to generate a list of categories but cannot get my head around how to do this.

 

Can anyone help?! I would struggle on but have problems at home right now and so would really appreciate assistance as my focus and clarity of reasoning this our is not 100% :(

 

I can generate the first level of categories but need the sub-categories of the first main one.

I would like ideally to have a module option page to select the level but that can come later...

 

many thanks,

Mike

Link to comment
Share on other sites

in php file you should use Category class - especially Category::getCategories function, it looks like:

 

public static function getCategories($id_lang = false, $active = true, $order = true, $sql_filter = '', $sql_sort = '', $sql_limit = '')

 

with this function you will get list of all categories available in your store.

 

then create a smarty array with this function return value (lis of categories). After that you will be able to use this variable in the .tpl fule (for example: in foreach lop to get each category specification)

  • Like 2
Link to comment
Share on other sites

and of course you have to use Link class to create an url to the category page, something like:

{$link->getCategoryLink({$id_category})}

 

if you will have any questions - feel free to write, im lovin modifications like this so i will help with pleasure ;)

Link to comment
Share on other sites

  • 2 weeks later...

...

then create a smarty array with this function return value (lis of categories)

...

Can you please give the code, that creates this array? 

I am new to smarty, and I think I did something wrong about the syntax, so I can't get any categories variables in .tpl

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