I really can add a category through a setup script, thing for some reason some of the fields are not set properly. Here is my code
$this->startSetup();
Mage::register('isSecureArea', 1);
$category = Mage::getModel('catalog/category');
$category->setPath('1/2')
->setName('Category Name')
->setUrlKey('category-name')
->setIsActive(0)
->setIncludeInMenu(1)
->setInfinitescroll(1)
->setDisplayMode('PAGE')
->setLandingPage($idToCmsBlock)
->setPageLayout('anotherLayoutThanDefault')
->setCustomUseParentSettings(0)
->setCustomLayoutUpdate('<reference name="head"><action method="addCss"><stylesheet>css/somecss.css</stylesheet></action></reference>')
->save();
$this->endSetup();
After running this script, I have a category created with all my value set in the EAV table. However, Flat Table will be missing displayMode, landingPage, pageLayout, customLayoutUpdate, even if I re-index the flat table.
The strange thing is that if I go to the admin, I can see all these fields correctly, but if I go to my interface, most of these fields will be ignored. I need to go to the administrator, disable these values ββand reset for each of them so that they work correctly.
, setEnabled (1), "" admin, .
PS: Flat Category, , , , .