0

I use magento 1.9.x version, I add a new contact form in product view page, but after I press Submit button the magento is redirect me to the Contact page how I can stop this redirect and remain in the same page.

I try to put this code in contact controller

            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.'));
           if(Mage::helper('core/http')->getHttpReferer(true)){
            $this->_redirectUrl(Mage::helper('core/http')->getHttpReferer(true)); 
            }
             else{
            $this->_redirect('*/*/');
            }

is work is stay in the same page but I don't see that success message:

"Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us."

How I can add that message too?

| improve this question | | | | |
1

Make sure you have put global_messages block on your page.

<?php echo $this->getChildHtml('global_messages') ?>

Also try with below code.

Mage::getSingleton('core/session')->addSuccess( Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
| improve this answer | | | | |
  • Hi, your below code is work perfectly, thank you so much – Robert Feb 18 '17 at 8:27

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.