Using Magento I am trying to script my entire sites config and settings using install scripts so I can keep the whole site under version control.

I am now at the point of creating my categories.

I have seen many ways of doing this however nothing really non 'hacky'. Taking the following example category structure and keeping in mind I will have a maximum of only 20-30 categories what is the recommended way of approaching this? I would also like the script to Update if the category already exists.

- Public Catalog
    - Mens
        - Tops
        - Bottoms
    - Womens
        - Dresses
        - Shoes 

I also want to be able to insert a category thumbnail and image which I have not found an example of.


1 Answer 1


I think a cool way of doing this is using data-install-scripts. data-install scripts are like sql-install-scripts but they are run after environnement initailization so you can use Magento models for creating your categories like you would do in any standalone script.

You can place you data-install-script is a folder (almost like sql-scripts):


If you have a multi-store-view shop, you should be sure your store configuration will be setup (maybe you place it also into setup scripts ?)


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.