Magento 1.7 Admin Extension – Save Event

adminmagento-1.7

is there any event in admin 

for when save item or save and continue button pressed in my custom extension?

enter image description here

Best Answer

You will have to add that event yourself to your controller, to check what button is clicked you can do the following:

In your block widget definition for your edit form you need to configure your save and continue url for the button:

public function getSaveAndContinueUrl()
{
    return $this->getUrl('*/*/save', array(
        '_current'   => true,
        'back'       => 'edit',
    ));
}

And in the saveAction function you can then check if the parameter back is used:

    $redirectBack   = $this->getRequest()->getParam('back', false);

    if ($redirectBack) {
        $this->_redirect('*/*/edit', array(
            'id'    => $productId,
            '_current'=>true
        ));
    }
    Mage::dispatchevent('myevent',array('mydata'=>$data,'rediredit'=>$redirectBack));

You also need to set

In the event observer you can check the clicked button, when rediredit is false the save button is clicked, else the save and continue edit button is clicked.