I've created a Magento plugin with a simple admin html observer:

This file looks like this:

//File: /Model/Adminhtml/Observer.php

class Aaa_Bbb_Model_Adminhtml_Observer
        public function saveOrderData(Varien_Event_Observer $observer)
        // example

        public function saveCustomOrderData() {
           // save data to a custom database table. 

Now I've to create an adminhtml controller in the file /controllers/CustomOrderData.php. In this file I have to call the method saveCustomOrderData() in my Observer.php.

How can I call this method? Or is there a better place to store data in a custom table, from 2 files (the observer and controller method)?

1 Answer 1


In you case I recommend to create a model, that is responsible for data management and saving to the database. Then call this model methods from the controller and observer when needed.

This is official guide for custom module with database table, where you can find how to create models, controllers and observers:

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.