Recently I had to add a new payment method to a Magento site. It had no functionality as such, it just had to appear in the New Order screen in the admin area as well as the order grid itself. This was so that it could be used for orders that came in over the phone, but it didn’t need to connect to any payment gateways or such like.

Essentially we need to set up a custom module. There are a few steps here:

app/etc/modules - Create a file called CompanyName_ModuleName.xml - eg Acme_EVT.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Acme_EVT>
            <active>true</active>
            <codePool>local</codePool>
        </Acme_EVT>
    </modules>
</config> 

app/code/local/Acme/ModuleName/etc Create this folder. You could have other custom modules in the Acme folder.

Two files in the etc folder - config.xml and system.xml. The following are the contents of the config.xml file.

etc/config.xml

<?xml version="1.0" encoding="utf-8"?>
	<config>
		<modules>
			<Acme_EVT>
				<version>1.0.0</version>
			</Acme_EVT>
		</modules>
		<global>
			<models>
				<evt>
					<class>Acme_EVT_Model</class>
				</evt>
			</models>
			<helpers>
				<evt>
					<class>Acme_EVT_Helper</class>
				</evt> 
			</helpers>
			<blocks>
				<evt>
					<class>Acme_EVT_Block</class>
				</evt>
			</blocks>
		</global>
		<default>
			<payment>
				<evt>
					<model>evt/standard</model>
					<active>1</active>
					<order_status>pending</order_status>
					<title>EVT</title>					
					<sort_order>1</sort_order>
				</evt>
			</payment>
		</default>
		<frontend>
			<routers>
				<evt>
					<use>standard</use>
					<args>
						<module>Acme_EVT</module>
						<frontname>evt</frontname>
					</args>
				</evt>
			</routers>
		</frontend>
	</config>

Note the evt/standard bit here:

<default>
			<payment>
				<evt>
					<model>evt/standard</model>

This refers to a file called Standard.php in a folder called Model, within the same EVT folder. So you will have Acme/etc and Acme/Model. Please make sure to have Standard.php in uppercase, and evt/standard in lowercase. I had the file named standard.php and it didn’t work. Took a while to figure that one out!

etc/system.xml

<?xml version="1.0"?>
<config>
   <sections>
        <payment>            
            <groups>
              <evt translate="label">
                <label>EVT</label>
                <frontend_type>text</frontend_type>
                <sort_order>1000</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>0</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>
                  <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>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_processing</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>
                  </order_status>                  
                  <instructions translate="label">
                    <label>Displayed Message</label>
                    <frontend_type>textarea</frontend_type>
                    <sort_order>4</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                  </instructions>              
                </fields>
              </evt>
            </groups>
        </payment>
    </sections>
</config>

This is the bit that refers to the Admin > System Config > Payment Methods section of the back office.

Model/Standard.php

<?php 
class Acme_EVT_Model_Standard extends Mage_Payment_Model_Method_Abstract
{ 
protected $_code = 'evt'; 
protected $_canUseInternal = true;
protected $_canUseCheckout = false;
protected $_canUseForMultishipping = false;  
}
?>

The whole point of this page is to specify where this new payment method can be used. In my case I only have $_canUseInternal set to true, as it can only be used inhouse, ie, via the back office or admin area. It cannot be used on the website.

I think that was it. The bit that got me most was the Standard.php filename - I went around in circles for hours because it was not showing up on the New orders page and it turned out to be just an uppercase/lowercase issue!