1

What's the proper way to define functions used in installation scripts? I have a long list of data to add in a module, and I'd like to avoid writing a long serial script or just including functions at the bottom or top of the installation script files.

Specifically, I'm wondering if there's a .php file that can be included for the data or sql scripts.

UPDATE: See my answer.

1
  • Your question is a bit unclear (at least to me). Can you provide a small example of what you are trying to achieve?
    – Marius
    Commented Jan 6, 2014 at 19:19

2 Answers 2

1

The best way should be using an own Setup.php.

You may use http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources as an entry point.

1

Under the resources node for the installation script, you can define your own class to be used. $this, then, in the installation script will be of class Mage_Catalog_Model_Resource_Catalog_Setup in this example.

<resources>
    <abc_setup>
        <setup>
            <module>Test_Abc</module>
            <class>Mage_Catalog_Model_Resource_Catalog_Setup</class>
        </setup>
    </abc_setup>
</resources>

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.