Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

magento custom module controller can’t get the toHtml() function
 
jorgeworks
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2010-12-15
 

My custom module is a payment gateaway, i have a redirect controller and here is the script

class Asurepay_Custompay_AsurepayController extends Mage_Core_Controller_Front_Action {
    
        
protected $_order;
    
        public function 
getOrder() {
            
if ($this->_order == null{
    
            }
            
return $this->_order;
        
}
    
        
public function indexAction(){
            
echo "index test 1";
        
}
    
        
public function redirectAction(){
            $session 
Mage::getSingleton('checkout/session');
            
$session->setAsurepayCustompayQuoteId($session->getQuoteId());
            
$this->getResponse()->setBody($this->getLayout()->createBlock('asurepay/redirect')->toHtml());
            
$session->unsQuoteId();
            
$session->unsRedirectUrl();
        
}
    
    }

The function redirectAction() can’t get the toHtml() function

and here is the error:

Fatal errorCall to a member function toHtml() on a non-object in my code

what should be the error of this? I have a block in ModuleName/Block/Redirect.php and I have a toHtml(). or what should be the cause of error?

 
Magento Community Magento Community
Magento Community
Magento Community
 
magestore_1
Mentor
 
Avatar
Total Posts:  1015
Joined:  2009-08-07
Viet Nam
 

Hi,
You try to change the code

$this->getLayout()->createBlock('asurepay/redirect')

by

$this->getLayout()->createBlock('custompay/redirect')

Regards,
Alex.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top