We have build a custom Magento module for contact inquiries in our webshop.
Please see the IndexController below. We would like to change the redirect route per store view. How we can achieve this?
<?php
class MVE_ContactInquiry_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'mve.contact_inquiry',
array(
'template' => 'mve/contact_inquiry.phtml'
)
);
$this->getLayout()->getBlock('content')->append($block);
//$this->getLayout()->getBlock('right')->insert($block, 'catalog.compare.sidebar', true);
$this->_initLayoutMessages('core/session');
$this->renderLayout();
}
public function sendemailAction()
{
$params = $this->getRequest()->getParams();
$mail = new Zend_Mail();
$bodytext = '
Naam: ' . $params['name'] . '
E-mailadres: ' . $params['email'] . '
Telefoonnummer: ' . $params['telephone'] . '
Bericht:
' . $params['comment'];
$mail->setBodyText( $bodytext );
$mail->setFrom($params['email'], $params['name']);
$mail->addTo('example@gmail.com');
$mail->setSubject('Contact aanvraag');
try {
$mail->send();
}
catch(Exception $ex) {
Mage::getSingleton('core/session')->addError('Unable to send email.');
}
$this->_redirect('contact/bedankt');
}
}
?>
Option 1
In /app/code/local/MVE/ContactInquiry/etc/system.xml
Assuming that you want to create your own Tab in the left nav
To get the value in you controller you do
Mage::getStoreConfig(‘contactinquiry/general_option/redirect_url’, Mage::app()->getStore()->getId())
see XML for Admin Configurations for more help
Option 2
Option 3
You could also add a hidden field in each form which contain the url to redirect to