Jump to content

Problem with create category tree (php)


Recommended Posts

Hi all,

 

I have problem with create category tree by php for import products. It works (in foreach):

 $object = new Category();
                $object->name = array((int)Configuration::get('PS_LANG_DEFAULT') => $struct_cat_ar[$jk]);
                $object->id_parent = $id_parent;        
                $object->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') =>  friendly_url($struct_cat_ar[$jk]));
                $object->add();

It´s for XML import and in XML Category tree for product is in text form by | divider. For example:

Main Category|Tools|Hand Tools

I assoc this by explode("|",... to array $struct_cat_ar . It´s fine, but how make all structure and parent structure ?

 

Some idea?

 

Many Thanks,

 

Jan

 

Link to comment
Share on other sites

×
×
  • Create New...