1

I'm trying to call a function in an observer from another observer. I have a custom product type I've created called assembly. In my assembly config.xml

    <catalog_product_prepare_save>
        <observers>
            <assembly_observer>
                <class>assembly/observer</class>
                <method>prepareProductSave</method>
            </assembly_observer>
        </observers>
    </catalog_product_prepare_save>

and in the model/observer.php

class MyNamespace_Assembly_Model_Observer
{
    public function MyFunction($observer)
    {
    }
}

How do I call MyFunction($observer) from an observer I have in another module?

3

Like any other model function:

Mage::getSingleton('assembly/observer')->MyFunction(...);

or, if you do not work with singleton observers:

Mage::getModel('assembly/observer')->MyFunction(...);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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