Jump to content

[SOLVED] Create a category from a module


orwell

Recommended Posts

Hi !

 

I'm writing a custom module and I need to create new categories from there.

 

I'm wondering which is the best and easiest way to create a new category from a script. I can't find a method in the Category class to do so...

 

Maybe someone has a snippet ready to use.

 

Thank you

Edited by orwell (see edit history)
Link to comment
Share on other sites

Thank you for pointing this out.

I had some trouble to set the translated fields but I found a way to do it.

$category->description = array((int)(Configuration::get('PS_LANG_DEFAULT')) => "here is my description");

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