Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redirect to a particular page after contact form is submitted in Magento

Tags:

magento

how can i re-direct to a particular page after the user submits the contact form in Magento? form.phtml has

<form action="<?php echo Mage::getUrl(); ?>contacts/index/post/" id="contactForm" method="post">

but i'm not sure where to find the php file that controls the email sending and redirects. any ideas? thanks

EDIT: found this in IndexController.php under app > code > core > Mage > Contacts > controllers

$this->_redirect('*/*/');
like image 374
pixeltocode Avatar asked Jul 23 '10 02:07

pixeltocode


1 Answers

I know its answered, just sharing my experience. I had made a contact form through a CMS page. The form worked fine. But after submitting it, it would redirect to the magento contact form. To redirect it back to CMS page, i had to put

$this->_redirect('contactus');

where contactus is the URL identifier.

Also after redirect, the success / error message would not show up. For that i had to make changes here.

Go to /app/design/frontend/default/yourstore/template/contacts/form.phtml

<div id="messages_product_view">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
</div>

with:

<?php Mage::app()->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('customer/session')->getMessages(true)); ?> 

I got the solution from here

like image 175
codingbbq Avatar answered Oct 11 '22 19:10

codingbbq