Try the Demo

Magento Forum

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

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?

 Signature 

I’m a magento beginner! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
magestore
Enthusiast
 
Avatar
Total Posts:  961
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.

 Signature 

Mega Menu brings flexible configuration to store’s navigation Menu
Magento Extensions and Templates: Affiliate, Store pickup, Gift-wrap, Gift voucher, 1stepcheckout, Auction…
Magento Affiliate - Full-functioned Magento extension to run Affiliate program at $99

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