app\code\local\Mycustomcard\Mycustom\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycustomcard_Mycustom>
<version>0.1.0</version>
</Mycustomcard_Mycustom>
</modules>
<frontend>
<routers>
<mycustom>
<use>standard</use>
<args>
<module>Mycustomcard_Mycustom</module>
<frontName>mycustom</frontName>
</args>
</mycustom>
</routers>
<layout>
<updates>
<mycustom>
<file>mycustom.xml</file>
</mycustom>
</updates>
</layout>
</frontend>
<global>
<fieldsets>
<sales_convert_quote_payment>
<check_no>
<to_order_payment>*</to_order_payment>
</check_no>
<check_date>
<to_order_payment>*</to_order_payment>
</check_date>
</sales_convert_quote_payment>
</fieldsets>
<models>
<mycustom>
<class>Mycustomcard_Mycustom_Model</class>
<resourceModel>mycustom_mysql4</resourceModel>
</mycustom>
<mycustom_mysql4>
<class>Mycustomcard_Mycustom_Model_Mysql4</class>
<entities>
<mycustom>
<table>mycustom</table>
</mycustom>
</entities>
</mycustom_mysql4>
</models>
<resources>
<mycustom_setup>
<setup>
<module>Mycustomcard_Mycustom</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mycustom_setup>
<mycustom_write>
<connection>
<use>core_write</use>
</connection>
</mycustom_write>
<mycustom_read>
<connection>
<use>core_read</use>
</connection>
</mycustom_read>
</resources>
<blocks>
<mycustom>
<class>Mycustomcard_Mycustom_Block</class>
</mycustom>
</blocks>
<helpers>
<mycustom>
<class>Mycustomcard_Mycustom_Helper</class>
</mycustom>
</helpers>
</global>
<default>
<payment>
<mycustom>
<active>1</active>
<model>mycustom/mycustom</model>
<order_status>processing</order_status>
<title>Mycustom Payment Method</title>
<message>Please draw check in favour of Test Corporation: #XXXX-XXXX</message>
</mycustom>
</payment>
</default>
</config>
app\code\local\Mycustomcard\Mycustom\etc\system.xml
<?xml version="1.0"?>
<config>
<sections>
<!-- payment tab -->
<payment>
<groups>
<!-- mycustom fieldset -->
<mycustom translate="label" module="paygate">
<!-- will have title 'New Module' -->
<label>Mycustom payment</label>
<!-- position between other payment methods -->
<sort_order>670</sort_order>
<!-- do not show this configuration options in store scope -->
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<!-- is this payment method active for the website? -->
<active translate="label">
<!-- label for the field -->
<label>Enabled</label>
<!-- input type for configuration value -->
<frontend_type>select</frontend_type>
<!-- model to take the option values from -->
<source_model>adminhtml/system_config_source_yesno</source_model>
<!-- field position -->
<sort_order>1</sort_order>
<!-- do not show this field in store scope -->
<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>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</title>
<currency translate="label">
<label>Currency</label>
<frontend_type>text</frontend_type>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</currency>
<partner_code translate="label">
<label>Partner Code</label>
<frontend_type>text</frontend_type>
<sort_order>5</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</partner_code>
<partner_key translate="label">
<label>Partner Key</label>
<frontend_type>text</frontend_type>
<sort_order>6</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</partner_key>
<payee translate="label">
<label>Payee</label>
<frontend_type>text</frontend_type>
<sort_order>7</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</payee>
</fields>
</mycustom>
</groups>
</payment>
</sections>
</config>
app\code\local\Mycustomcard\Mycustom\Helper\Data.php
class Mycustomcard_
{
}
app\code\local\Mycustomcard\Mycustom\Model\Mycustom.php
class Mycustomcard_Mycustom_Model_Mycustom extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'mycustom';
protected $_formBlockType = ' mycustom/form_ mycustom';
protected $_infoBlockType = ' mycustom/info_ mycustom ';
//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 assignData($data)
{
if (!($data instanceof Varien_Object)) {
$data = new Varien_Object($data);
}
$info = $this->getInfoInstance();
$info->setCheckNo($data->getCheckNo())
->setCheckDate($data->getCheckDate());
return $this;
}
public function validate()
{
parent::validate();
$info = $this->getInfoInstance();
$no = $info->getCheckNo();
$date = $info->getCheckDate();
if(empty($no)){
$errorCode = 'invalid_data';
$errorMsg = $this->_getHelper()->__('Check No and Date are required fields');
}
if($errorMsg){
Mage::throwException($errorMsg);
}
return $this;
}
}
To check part 3 code continues....
<?xml version="1.0"?>
<config>
<modules>
<Mycustomcard_Mycustom>
<version>0.1.0</version>
</Mycustomcard_Mycustom>
</modules>
<frontend>
<routers>
<mycustom>
<use>standard</use>
<args>
<module>Mycustomcard_Mycustom</module>
<frontName>mycustom</frontName>
</args>
</mycustom>
</routers>
<layout>
<updates>
<mycustom>
<file>mycustom.xml</file>
</mycustom>
</updates>
</layout>
</frontend>
<global>
<fieldsets>
<sales_convert_quote_payment>
<check_no>
<to_order_payment>*</to_order_payment>
</check_no>
<check_date>
<to_order_payment>*</to_order_payment>
</check_date>
</sales_convert_quote_payment>
</fieldsets>
<models>
<mycustom>
<class>Mycustomcard_Mycustom_Model</class>
<resourceModel>mycustom_mysql4</resourceModel>
</mycustom>
<mycustom_mysql4>
<class>Mycustomcard_Mycustom_Model_Mysql4</class>
<entities>
<mycustom>
<table>mycustom</table>
</mycustom>
</entities>
</mycustom_mysql4>
</models>
<resources>
<mycustom_setup>
<setup>
<module>Mycustomcard_Mycustom</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mycustom_setup>
<mycustom_write>
<connection>
<use>core_write</use>
</connection>
</mycustom_write>
<mycustom_read>
<connection>
<use>core_read</use>
</connection>
</mycustom_read>
</resources>
<blocks>
<mycustom>
<class>Mycustomcard_Mycustom_Block</class>
</mycustom>
</blocks>
<helpers>
<mycustom>
<class>Mycustomcard_Mycustom_Helper</class>
</mycustom>
</helpers>
</global>
<default>
<payment>
<mycustom>
<active>1</active>
<model>mycustom/mycustom</model>
<order_status>processing</order_status>
<title>Mycustom Payment Method</title>
<message>Please draw check in favour of Test Corporation: #XXXX-XXXX</message>
</mycustom>
</payment>
</default>
</config>
app\code\local\Mycustomcard\Mycustom\etc\system.xml
<?xml version="1.0"?>
<config>
<sections>
<!-- payment tab -->
<payment>
<groups>
<!-- mycustom fieldset -->
<mycustom translate="label" module="paygate">
<!-- will have title 'New Module' -->
<label>Mycustom payment</label>
<!-- position between other payment methods -->
<sort_order>670</sort_order>
<!-- do not show this configuration options in store scope -->
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<!-- is this payment method active for the website? -->
<active translate="label">
<!-- label for the field -->
<label>Enabled</label>
<!-- input type for configuration value -->
<frontend_type>select</frontend_type>
<!-- model to take the option values from -->
<source_model>adminhtml/system_config_source_yesno</source_model>
<!-- field position -->
<sort_order>1</sort_order>
<!-- do not show this field in store scope -->
<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>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</title>
<currency translate="label">
<label>Currency</label>
<frontend_type>text</frontend_type>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</currency>
<partner_code translate="label">
<label>Partner Code</label>
<frontend_type>text</frontend_type>
<sort_order>5</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</partner_code>
<partner_key translate="label">
<label>Partner Key</label>
<frontend_type>text</frontend_type>
<sort_order>6</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</partner_key>
<payee translate="label">
<label>Payee</label>
<frontend_type>text</frontend_type>
<sort_order>7</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</payee>
</fields>
</mycustom>
</groups>
</payment>
</sections>
</config>
app\code\local\Mycustomcard\Mycustom\Helper\Data.php
class Mycustomcard_
Mycustom
_Helper_Data extends Mage_Core_Helper_Abstract{
}
app\code\local\Mycustomcard\Mycustom\Model\Mycustom.php
class Mycustomcard_Mycustom_Model_Mycustom extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'mycustom';
protected $_formBlockType = ' mycustom/form_ mycustom';
protected $_infoBlockType = ' mycustom/info_ mycustom ';
//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 assignData($data)
{
if (!($data instanceof Varien_Object)) {
$data = new Varien_Object($data);
}
$info = $this->getInfoInstance();
$info->setCheckNo($data->getCheckNo())
->setCheckDate($data->getCheckDate());
return $this;
}
public function validate()
{
parent::validate();
$info = $this->getInfoInstance();
$no = $info->getCheckNo();
$date = $info->getCheckDate();
if(empty($no)){
$errorCode = 'invalid_data';
$errorMsg = $this->_getHelper()->__('Check No and Date are required fields');
}
if($errorMsg){
Mage::throwException($errorMsg);
}
return $this;
}
}
To check part 3 code continues....
No comments:
Post a Comment