I get fatal error while setting up custom payment method block for checkout page
`Fatal error: Call to a member function setMethod() on a non-object in
app/code/core/Mage/Payment/Helper/Data.php on line 106`
Here's my Implementation
Payment Method File paths
app/code/local/SecurePay/SecureFrame/Block/Form
app/code/local/SecurePay/SecureFrame/controllers
app/code/local/SecurePay/SecureFrame/Model/Standard.php
Block Class
<?php
// app/code/local/SecurePay/SecureFrame/Block/Form/SecureFrame.php
class SecurePay_SecureFrame_Block_Form_SecureFrame extends Mage_Payment_Block_Form
{
protected function _construct()
{
parent::_construct();
$this->setTemplate('secureframe/form/secureframe.phtml');
}
}
Payment Model
<?php
class SecurePay_SecureFrame_Model_Standard extends Mage_Payment_Model_Method_Abstract {
protected $_code = 'secureframe';
protected $_formBlockType = 'secureframe/form_secureframe'; //This line thows the error
// other stuff ....
}
Also If I comment the line protected $_code = 'secureframe';
Error disappears but obviously custom payment block does not get set
Edit:
Config.xml File
<?xml version="1.0"?>
<config>
<modules>
<SecurePay_SecureFrame>
<version>0.1.0</version>
</SecurePay_SecureFrame>
</modules>
<global>
<models>
<secureframe>
<class>SecurePay_SecureFrame_Model</class>
</secureframe>
</models>
<helpers>
<secureframe>
<class>SecurePay_SecureFrame_Helper</class>
</secureframe>
</helpers>
<blocks>
<secureframe>
<class>SecurePay_SecureFrame_Block</class>
</secureframe>
</blocks>
</global>
<default>
<payment>
<secureframe>
<model>secureframe/standard</model>
<active>0</active>
<order_status>pending</order_status>
<title>Payment via Securepay</title>
<payment_action>sale</payment_action>
<test_mode>1</test_mode>
<merchant_id></merchant_id>
<allowspecific>0</allowspecific>
<currency_accepted>AUD</currency_accepted>
<sort_order>1</sort_order>
</secureframe>
</payment>
</default>
<frontend>
<routers>
<secureframe>
<use>standard</use>
<args>
<module>SecurePay_SecureFrame</module>
<frontName>SECUREPAY</frontName>
</args>
</secureframe>
</routers>
</frontend>
</config>
Template file path for phtml file in template directory
app/design/frontend/base/default/template/securepay/secureframe/form/secureframe.phtml
What I am doing wrong ?? How to resolve this error and display custom form on checkout page
P.S. Also tried placing the form phtml file outside the securepay
directory like
app/design/frontend/base/default/template/secureframe/form/secureframe.phtml
However error does not get resolved
Edit Here is the code from Helper file which is giving error
public function getMethodFormBlock(Mage_Payment_Model_Method_Abstract $method)
{
$block = false;
$blockType = $method->getFormBlockType();
if ($this->getLayout()) {
$block = $this->getLayout()->createBlock($blockType); // This might be causing error, not sure (from helper file reported in error)
$block->setMethod($method);
}
return $block;
}