Jump to content

ID category when add


Recommended Posts

Hello,

 I add category from code (below) and I need back her id. How to get this id? I use PS1.6

 

I use this code (found in forum):

$object = new Category();
$object->name = array((int)Configuration::get('PS_LANG_DEFAULT') => 'Cool name');
$object->id_parent = Configuration::get('PS_HOME_CATEGORY');
$object->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'cool-url');
$object->id_ = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'cool-url');
$object->add();       

 

I little speak english, but I hope we understand me :) Thanks

 

 

Link to comment
Share on other sites

×
×
  • Create New...