I would like to redirect all customers to a custom page after successful registration in Magento 1.9.
I have tried many things. Firstly, I am successfully overriding the core customer account controller.
I have attempted to customize the following actions:
By trying to set redirect url or by setting BeforeAuthUrl
//$successUrl = $this->_getUrl('*/*/index', array('_secure' => true));
$successUrl = $this->_getUrl('*/*/success');
$this->_getSession()->setBeforeAuthUrl('http://test.local/customer/account/success/');
if ($this->_getSession()->getBeforeAuthUrl()) {
$successUrl = $this->_getSession()->getBeforeAuthUrl(true);
}
return $successUrl;
Please note at this point, $successUrl is correct when it returns here. I see there are some post Dispatch methods that I am assuming are destorying this url and always returning to customer/account/index.
I have read several posts on this topic and cannot find a definitive answer that solves this question.
I have even set hidden form element 'success_url' in attempts to follow steps presented elsewhere as solutions to this.
What is the full, correct process that one needs to follow in order to be able to show a one time registration success page?
if you want to do this for customer successfully then you can do this using event observer
after customer successfully magento trigger an event customer_register_success
This call an observer which will reequestion to custtom page
Mage::app()->getResponse()->setRedirct($Yourdreicurll);
Details:
Step1:
create config.xml is app/code/community/Amit/Custommodule/etc/
<?xml version="1.0" ?>
<config>
<modules>
<Amit_Custommodule>
<version>1.0.0</version>
</Amit_Custommodule>
</modules>
<global>
<models>
<custommodule>
<class>Amit_Custommodule_Model</class>
</custommodule>
</models>
</global>
<frontend>
<events>
<customer_register_success>
<observers>
<notify_user>
<class>custommodule/observer</class>
<method>myredirection</method>
</notify_user>
</observers>
</customer_register_success>
</events>
</frontend>
</config>
Step2:
create module control file Module name as Amit_Custommodule.xml at app/etc/modules/
it code is
<?xml version="1.0"?>
<config>
<modules>
<Amit_Custommodule>
<codePool>community</codePool>
<active>true</active>
</Amit_Custommodule>
</modules>
</config>
Step3:
Create observer.php at Amit>Custommodule>Model
code is
<?php
class Amit_Custommodule_Model_Observer {
public function myredirection(Varien_Event_Observer $observer) {
$AccountController = $observer->getEvent()->getAccountController();
$Customer = $observer->getEvent()->getCustomer();
$response1 = Mage::app()->getResponse(); // observers have event args
$url = 'http://www.example.com/';
$response1->setRedirect($url);
Mage::app()->getFrontController()->sendResponse();
return;
}
}