I have this problem.
I send the email from http://www.chocolate-shop.it/it/contatti
but the page of return is /contacts/index/post
i can to modify the response page?
where is this page /contacts/index/post
how modify it?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI have this problem.
I send the email from http://www.chocolate-shop.it/it/contatti
but the page of return is /contacts/index/post
i can to modify the response page?
where is this page /contacts/index/post
how modify it?
In order to fulfill,your requirement,need to modify code of controller class Mage_Contacts_IndexController
on function postAction()
which written at app/code/core/Mage/Contacts/controllers/IndexController.php
.
So require to override this controller class. You need change all to
<?php
require_once Mage::getModuleDir('controllers', "Mage_Contacts").DS."IndexController.php";
class [ModuleNameSpace]_[ModuleName]_IndexController extends Mage_Contacts_IndexController
{
public function newAction()
{
$Cmsurl=Mage::getUrl('').'contatti';
//Mage::app()->getFrontController()->getResponse()->setRedirect($url);
$post = $this->getRequest()->getPost();
if ( $post ) {
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
try {
$postObject = new Varien_Object();
$postObject->setData($post);
$error = false;
if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
$error = true;
}
if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) {
$error = true;
}
if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
$error = true;
}
if (Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
$error = true;
}
if ($error) {
throw new Exception();
}
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
null,
array('data' => $postObject)
);
if (!$mailTemplate->getSentSuccess()) {
throw new Exception();
}
$translate->setTranslateInline(true);
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
// $this->_redirect('*/*/');
Mage::app()->getFrontController()->getResponse()->setRedirect($Cmsurl);
return;
} catch (Exception $e) {
$translate->setTranslateInline(true);
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
Mage::app()->getFrontController()->getResponse()->setRedirect($Cmsurl);
return;
}
} else {
Mage::app()->getFrontController()->getResponse()->setRedirect($Cmsurl);
}
}
}
.... <frontend> <routers> <contacts> <args> <modules> <customcontacts before="Mage_Contacts">[ModuleNameSpace]_[ModuleName]</customcontacts> </modules> </args> </contacts> </routers> </frontend> ...
For How to override a controller in Magento checkout this link