I have a data install script which requires access to the default stores root category.

If the code for the module is run when the site is first installed, the value is never available i.e.


returns null



returns 0 instead of 1.

I suspect this is something related to the stores not being fully during installation. How can i get access to the default store views root category id during installation?

1 Answer 1


Try this :

$store = Mage::getModel('core/store')->load(Mage_Core_Model_App::DISTRO_STORE_ID);
$rootId = $store->getRootCategoryId();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.