I am developing a payment module for Magento. I did it using this tutorial
http://www.magentocommerce.com/wiki/5_-_modules_and_development/payment/create-payment-method-module
I created a folder
app/local/Companyname/Cashondelivery/Block app/local/Companyname/Cashondelivery/Model app/local/Companyname/Cashondelivery/controller app/local/Companyname/Cashondelivery/etc app/local/Companyname/Cashondelivery/helpers
Etc / config.xml file
<?xml version="1.0"?> <config> <modules> <Companyname_Cashondelivery> <version>0.1.0</version> </Companyname_Cashondelivery> </modules> <global> <models> <createorder> <class>Companyname_Cashondelivery_createorder</class> </createorder> </models> <resources> <cashondelivery_setup> <setup> <module>Companyname_Cashondelivery</module> </setup> <connection> <use>core_setup</use> </connection> </cashondelivery_setup> <cashondelivery_write> <connection> <use>core_write</use> </connection> </cashondelivery_write> <cashondelivery_read> <connection> <use>core_read</use> </connection> </cashondelivery_read> </resources> </global> <default> <payment> <cashondelivery> <active>0</active> <model>cashondelivery/createorder</model> <order_status>pending</order_status> <title>Companyname</title> </cashondelivery> </payment> </default> </config>
Application / local / Companyname / Modulename / etc / system.xml
<?xml version="1.0"?> <config> <sections> <payment> <groups> <cashondelivery translate="label" module="cashondelivery"> <label>Cash On Delivery</label> <frontend_type>text</frontend_type> <sort_order>10</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>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </active> <email_customer translate="label"> <label>Email Customer</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> </email_customer> <login translate="label"> <label>API Login ID</label> <frontend_type>obscure</frontend_type> <backend_model>adminhtml/system_config_backend_encrypted</backend_model> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </login> <merchant_email translate="label"> <label>Merchant Email</label> <frontend_type>text</frontend_type> <sort_order>11</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </merchant_email> <order_status translate="label"> <label>New Order Status</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_order_status_processing</source_model> <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> </order_status> <sort_order translate="label"> <label>Sort Order</label> <frontend_type>text</frontend_type> <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> </sort_order> <test translate="label"> <label>Test Mode</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <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> </test> <debug translate="label"> <label>Debug</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <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> </debug> <title translate="label"> <label>Title</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </title> <payment_action translate="label"> <label>Payment Action</label> <frontend_type>select</frontend_type> <source_model>cashondelivery/createorder</source_model> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </payment_action> <cgi_url> <label>Gateway URL</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> </cgi_url> <min_order_total translate="label"> <label>Minimum Order Total</label> <frontend_type>text</frontend_type> <sort_order>98</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </min_order_total> <max_order_total translate="label"> <label>Maximum Order Total</label> <frontend_type>text</frontend_type> <sort_order>99</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </max_order_total> <allow_partial_authorization translate="label"> <label>Allow Partial Authorization</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <sort_order>110</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </allow_partial_authorization> <model> </model> </fields> </cashondelivery> </groups> </payment> </sections> </config>
Then I created a model class
<?php class Companyname_Cashondelivery_Model_createorder extends Mage_Payment_Model_Method_Cc { protected $_code = 'newmodule'; protected $_isGateway = true; protected $_canAuthorize = true; protected $_canCapture = false; protected $_canCapturePartial = false; protected $_canRefund = false; protected $_canVoid = true; protected $_canUseInternal = true; protected $_canUseCheckout = true; protected $_canUseForMultishipping = true; protected $_canSaveCc = false; } ?>
I even created a file in app / local / Companyname / Cashondelivery / Helper / Data.php
<?php class Companyname_Cashondelivery_Helper_Data extends Mage_Core_Helper_Abstract { } ?>
But I get an error when opening the configuration> Payment methods
Fatal error: class 'Mage_Cashondelivery_Helper_Data' was not found in C: \ xampp \ htdocs \ magento \ app \ Mage.php on line 516
Is it necessary to have a Helper class. I have no idea about helpers and Data.php
naquiuddin
source share