I have an observer for
checkout_onepage_controller_success_action
which will call the method :
sendSmsOnSuccess()
The method is as follows :
public function sendSmsOnSuccess($observer)
{
if($order->getStatus()== ($this->ORDER_STATUS_COMPLETE) || $order->getStatus()== ($this->ORDER_STATUS_PROCESSING))
{
if(!$this->sandbox){
$helper->prepareSmsData($orderid);
}
}
}
The prepareSmsData method :
public function prepareSmsData($orderid,$showAlert=false)
{
// after some processing the data
return($this->sendSms($sms_text,$customerData->getTelephone(),$showAlert));
}
The sendSms Method
private function sendSms($text,$gsm_num,$showAlert)
{
if(!Mage::registry('messageDisplayed')){
Mage::register('messageDisplayed',true);
$session = Mage::getSingleton('core/session');
$message = 'Coupon code & Redeem code sent to your mobile number ('.$gsm_num.')';
$session->addSuccess($message);
if($showAlert)
{
echo('<script language="JavaScript" type="text/javascript">
alert("Message sent to Mobile Number");
window.close();
</script>');
}
}
}
The problem is : the successMessage is never displayed on frontend, if i var_dump($session) with in the sendSms method, i can see the success message. i tried to display successMessage even from the Observer.php. but not showing at all