I'm trying to create a custom payment model, a simple one without database changes, but I have a problem, when I select it in the checkout it said:
The request Payment Method is not available
Now, the debug:
In
Mage_Payment_Model_Method_Abstract
with$this->getCode()
, I can't see my custom methodIn a observer, like above, I can't see my method
- In
template/checkout/onepage/payment/methods.phtml
I can see it
I suppose my config.xml
and system.xml
are working because:
- I can see it in the admin area and save it
- I can see the value in
core_config_data
- I can see it in the checkout
- I compare with other extensions and it looks the same
Now in Mage/Payment/Model/Method/Abstract.php
inside function isAvailable
I put some logs and:
$isActive == 1
$isAvailable == 1
$isDeniedInConfig == ''
But still doesn't work.
My code:
config.xml
<config>
<modules>
<Namespace_Pay>
<module>0.0.1</module>
</Namespace_Pay>
</modules>
<global>
<helpers>
<pay>
<class>Namespace_Pay_Helper</class>
</pay>
</helpers>
<models>
<pay>
<class>Namespace_Pay_Model</class>
</pay>
</models>
</global>
<default>
<payment>
<namespace_pay>
<active>1</active>
<title>Title</title>
<model>pay/store</model>
<order_status>processing</order_status>
<allowspecific>0</allowspecific>
<payment_action>sale</payment_action>
</namespace_pay>
</payment>
</default>
</config>
system.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sections>
<payment>
<groups>
<pay translate="label" module="pay">
<label>Label</label>
<sort_order>670</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>1</show_in_store>
</active>
<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>
<allowspecific translate="label">
<label>Payment from applicable countries</label>
<frontend_type>allowspecific</frontend_type>
<sort_order>40</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>Payment from Specific countries</label>
<frontend_type>multiselect</frontend_type>
<sort_order>50</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>
<can_be_empty>1</can_be_empty>
</specificcountry>
<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>
</fields>
</pay>
</groups>
</payment>
</sections>
</config>
Store.php (Model)
<?php
class Namespace_Pay_Model_Store
extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'pay';
}