0

the case is as follow i create a module that save articles in DB and when the the saving is successfull i need to redirect the user to thanks page .the contoller render the default layout in the index method how i render another layout when the saving process is complete in save method ,my module structure is as follow enter image description here

0
    public function saveAction(){

         $request_type = $this->getRequest()->getPost('request_type');
         $title = $this->getRequest()->getPost('title');

         $contact = Mage::getModel('hyper_membership/membership');  
         $contact->setData('request_type',$request_type)
         $contact->setData('title',$title)

         try {
              $contact->save()
              $this->_redirect('*/*/success')
              return;
         }catch (Exception $e) {
              ...
              $this->_redirect('*/*/error')
              return;
         }
    }


public function successAction(){
     $this->loadLayout();
     $this->renderLayout(); 
}

public function errorAction(){
     $this->loadLayout();
     $this->renderLayout(); 
}

You can then add the success and error pages to your xml

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.