1

I'm just solved my problem with my contact form (https://www.clay-and-paint.com/index.php/contact/) returned me an 404 error page but it still doesn't work!!

When I push on submit, I have the sentence "Unable to submit your request. Please, try again later". I don't know what is the problem.

This is the code of my IndexController.php (app > code > core > Mage > contacts > controllers > IndexController.php):

class Mage_Contacts_IndexController extends Mage_Core_Controller_Front_Action
{

    const XML_PATH_EMAIL_RECIPIENT  = 'contacts/email/recipient_email';
    const XML_PATH_EMAIL_SENDER     = 'contacts/email/sender_email_identity';
    const XML_PATH_EMAIL_TEMPLATE   = 'contacts/email/email_template';
    const XML_PATH_ENABLED          = 'contacts/contacts/enabled';

    public function preDispatch()
    {
        parent::preDispatch();

        if( !Mage::getStoreConfigFlag(self::XML_PATH_ENABLED) ) {
            $this->norouteAction();
        }
    }

    public function indexAction()
    {
        $this->loadLayout();
        $this->getLayout()->getBlock('contactForm')
            ->setFormAction( Mage::getUrl('*/*/post') );

        $this->_initLayoutMessages('customer/session');
        $this->_initLayoutMessages('catalog/session');
        $this->renderLayout();
    }

    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('*/*/');
        }
    }

}

And this is the code on my form.phtml (app > design > frontend > galaeva > Default > template >

I can fill the entire required fields on my contact form but when I push on the submit button, it doesn't send the contact form and give me the sentence "Unable to submit..."

When I look on my firebug, I don't see error, just warning "Password fields present on a non-secure page (http: //). This represents a security risk for theft of login credentials." I don't know how it's possible because my website is in https!!

And I don't know if it's linked with my problem!

Somebody see any error on my code? Or have a suggestion for my problem?

Thank you.

  • check var/log folder for errors. – Marius Jan 27 '15 at 08:47
  • 1
    @Marius I've already tried that but I have no exception.log on my var/log to see an error. I put on my admin panel in system > configuration > developer > logging setting > on activated with system.log for Name system log file and exception.log for Name exception log. And on system.log I don't have any error from 2015! – Anne Tromme Jan 27 '15 at 09:03
  • Did you check in var/report folder? – Lord Skeletor Jan 27 '15 at 22:26
  • @Reindex 'Em All - Yes but I don't have any file on var/report or var/log... and I've put on "active" the exception.log and system.log on the admin panel. – Anne Tromme Jan 28 '15 at 15:01
  • Have a look through http://magento.stackexchange.com/questions/428/fundamentals-for-debugging-a-magento-store/429#429 and see if you can find any issues. The only other thing I can suggest is try using xdebug and stepping through the complete contact process. – David Manners Mar 25 '15 at 08:16

0 Answers0