public function editAction()
    {
        $model = $this->loadModel();
        if ($model->isObjectNew()) {
            $this->_forward('noroute');
            return;
        }

        if ($this->getRequest()->isPost()) {
            $postData = $this->getRequest()->getPost();
            try {
                foreach ($this->preprocessPostData($postData) as $key => $value) {
                    $model->setDataUsingMethod($key, $value);
                }
                $model->save();
                $this->_redirectUrl($this->getHelper()->getGridUrl());
                $this->_getSession()->addSuccess('Saved Successfully');
                return;
            } catch (Exception $e) {
                if ($e instanceof Zend_Db_Statement_Exception && $e->getChainedException() instanceof PDOException) {
                    $e = $e->getChainedException();
                }
                Mage::logException($e);
                $this->_getSession()->addError($e->getMessage());
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
public function editAction()
    {
        $model = $this->loadModel();
        if ($model->isObjectNew()) {
            $this->_forward('noroute');
            return;
        }

        if ($this->getRequest()->isPost()) {
            $postData = $this->getRequest()->getPost();
            try {
                foreach ($this->preprocessPostData($postData) as $key => $value) {
                    $model->setDataUsingMethod($key, $value);
                }
                $model->save();
                $this->_redirectUrl($this->getHelper()->getGridUrl());
                $this->_getSession()->addSuccess('Saved Successfully');
                return;
            } catch (Exception $e) {
                if ($e instanceof Zend_Db_Statement_Exception && $e->getChainedException() instanceof PDOException) {
                    $e = $e->getChainedException();
                }
                Mage::logException($e);
                $this->_getSession()->addError($e->getMessage());
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
public function editAction ( ) { $ model = $ this -> loadModel ( ) ; if ( $ model -> isObjectNew ( ) ) { $ this -> _forward ( 'noroute' ) ; return ; } if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ postData = $ this -> getRequest ( ) -> getPost ( ) ; try { foreach ( $ this -> preprocessPostData ( $ postData ) as $ key => $ value ) { $ model -> setDataUsingMethod ( $ key , $ value ) ; } $ model -> save ( ) ; $ this -> _redirectUrl ( $ this -> getHelper ( ) -> getGridUrl ( ) ) ; $ this -> _getSession ( ) -> addSuccess ( 'Saved Successfully' ) ; return ; } catch ( Exception $ e ) { if ( $ e instanceof Zend_Db_Statement_Exception && $ e -> getChainedException ( ) instanceof PDOException ) { $ e = $ e -> getChainedException ( ) ; } Mage :: logException ( $ e ) ; $ this -> _getSession ( ) -> addError ( $ e -> getMessage ( ) ) ; } } $ this -> loadLayout ( ) ; $ this -> renderLayout ( ) ; }
Edit an existing record
Edit an existing record