0

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?

1

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

Override controller code is look like:

<?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);
        }
    }

}

and config.xml code :

....
<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

|improve this answer|||||
  • I can not to modify only the page /contacts/index/post? – Alessandro Gnola Oct 9 '15 at 13:29
  • yes..you can do then it does not follow magento standard – Amit Bera Oct 9 '15 at 13:30
  • if I would only remove the side menu into this page? – Alessandro Gnola Oct 9 '15 at 13:36

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.