I'm trying to create a custom payment method according to this tutorial.
Everything looks fine from back-end. But payment method is not visible from front-end. Could any one help me on what exactly I'm missing.
/app/code/local/Rahul/Mycheckout/Model/standard.php
<?php
class Rahul_Mycheckout_Model_Standard extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'mycheckout';
protected $_formBlockType = 'mymodule/form';
protected $_isInitializeNeeded = true;
protected $_canUseInternal = false;
protected $_canUseForMultishipping = false;
/**
* Return Order place redirect url
*
* @return string
*/
public function getOrderPlaceRedirectUrl()
{
//when you click on place order you will be redirected on this url, if you don't want this action remove this method
return Mage::getUrl('customcard/standard/redirect', array('_secure' => true));
}
public function isAvailable() {
return true;
}
}
/app/code/local/Rahul/Mycheckout/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Rahul_Mycheckout>
<version>0.1.0</version>
</Rahul_Mycheckout>
</modules>
<global>
<models>
<mycheckout>
<class>Rahul_Mycheckout_Model</class>
</mycheckout>
</models>
<helpers>
<mycheckout>
<class>Rahul_Mycheckout_Helper</class>
</mycheckout>
</helpers>
<blocks>
<mycheckout>
<class>Rahul_Mycheckout_Block</class>
</mycheckout>
</blocks>
</global>
<default>
<payment>
<mycheckout>
<model>mycheckout/standard</model>
<!-- very important thing, here you select the model for your payment
method -->
<active>1</active>
<order_status>pending</order_status>
<title>CUSTOM CARD</title>
<payment_action>sale</payment_action>
<submit_url>https://someurl.com</submit_url>
<merchant_id>Insert merchant id</merchant_id>
<allowspecific>0</allowspecific>
<sort_order>1</sort_order>
</mycheckout>
</payment>
</default>
<frontend>
<routers>
<mycheckout>
<use>standard</use>
<args>
<module>Rahul_Mycheckout</module>
<frontname>customcard</frontname>
</args>
</mycheckout>
</routers>
</frontend>
</config>
/rahul/app/code/local/Rahul/Mycheckout/etc/system.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sections>
<payment>
<groups>
<mycheckout translate="label comment" module="paygate">
<label>Custom CARD MyCheckOut</label>
<frontend_type>text</frontend_type>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<active translate="label">
<label>Enabled</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</active>
<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</title>
<order_status translate="label">
<label>New Order Status</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status
</source_model>
<sort_order>50</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status>
<submit_url>
<label>Gateway URL</label>
<frontend_type>text</frontend_type>
<sort_order>58</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</submit_url>
<merchant_id>
<label>Merchant ID</label>
<frontend_type>text</frontend_type>
<sort_order>59</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</merchant_id>
<allowspecific translate="label">
<label>Payment Applicable From</label>
<frontend_type>select</frontend_type>
<sort_order>60</sort_order>
<source_model>adminhtml/system_config_source_payment_allspecificcountries
</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</allowspecific>
<specificcountry translate="label">
<label>Countries Payment Applicable From</label>
<frontend_type>multiselect</frontend_type>
<sort_order>70</sort_order>
<source_model>adminhtml/system_config_source_country
</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<depends>
<allowspecific>1</allowspecific>
</depends>
</specificcountry>
<sort_order translate="label">
<label>Sort Order</label>
<frontend_type>text</frontend_type>
</sort_order>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</fields>
</mycheckout>
</groups>
</payment>
</sections>
</config>
Best Answer
Implement method "isAvailable" in your payment class and let it return true;
public function isAvailable($quote = NULL)
rename your standard.php to Standard.php
If it still don't work, remove $_formBlockType property