I bought a magento based website some days ago.
There is a form in the page website.com/service
the actual code in the backend is:
{{block type="core/template" name="serviceForm" form_action="/contacts/index/service" template="contacts/form_service.phtml"}}
and in the front-end it is
<form method="post" id="contactForm" action="/contacts/index/service">
It is not exactly a contact form but contact form with lots of additional parameters.
What I want to do is edit the email address the form is submitted to.
If the form action was /contacts/index/post/ I could have edited the file at
/app/code/core/Mage/Contacts/controllers/IndexController.php
But I am unable to find any file where I can edit for /contacts/index/service . I think that the form is working as it tells me
Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.
after redirecting me to a certain page after form submission.
So I basically want to edit the email and need your help to find the location of the file.
@aynber located the function for me but I can't seem to find the email.
public function serviceAction()
{
$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('*/*/');
return;
} catch (Exception $e) {
$translate->setTranslateInline(true);
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
$this->_redirect('*/*/');
return;
}
} else {
$this->_redirect('*/*/');
}
}