cancel
Showing results for 
Search instead for 
Did you mean: 

Contacts page redirect blank page

Contacts page redirect blank page

My problem is that after contacs page submission the result is that "../contacts/index/post/" is a blank page

3 REPLIES 3

Re: Contacts page redirect blank page

Hi @gaepet

 

Go to following file app/code/core/Mage/Contacts/controllers/IndexController.php

and  check public function postAction()  {    

 

check if there is any erroneous code or exit;

 

 

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Contacts page redirect blank page

Hi,  what do you mean for "erroneous code or exit;"? Can you help me? 

Re: Contacts page redirect blank page

To figure out what triggers the issue, please do the following:

 

  • Enable error display and developer mode in your index.php (in the Magento root)
  • Try submitting a form again 

In case of a fatal error, it will get displayed there, and the error message will help in understanding the nature of the issue.

But I dare to assume that you might not get any message at all. Similar behavior is very typical of the cases, when errors don't get displayed (e.g. the lack of memory, etc.). 

As for the postAction method, it should look like this:

app/code/core/Mage/Contacts/controllers/IndexController.php

    public function postAction()
    {
        $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('*/*/');
        }
    }

 


______________________________________________________________
Innovative, top-performing Magento Extensions (with an array of FREE tools).