4

I have created a payment module but it is not rendered on the checkout page, while it is working in configuration -> payment methods.

This is my config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <EM_Netregistry>
            <version>1.1.0</version>
        </EM_Netregistry>
    </modules>
    <global>
        <models>
            <netregistry>
                <class>EM_Netregistry_Model</class>
            </netregistry>
        </models>
        <resources>
            <netregistry_setup>
                <setup>
                    <module>EM_Netregistry</module>
                    <class>Mage_Eav_Model_Entity_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </netregistry_setup>
            <netregistry_write>
                <use>core_write</use>
            </netregistry_write>
            <netregistry_read>
                <use>core_read</use>
            </netregistry_read>
        </resources>
        <blocks>
            <netregistry>
                <class>EM_Netregistry_Block</class>
            </netregistry>
        </blocks>
        <helpers>
            <netregistry>
                <class>EM_Netregistry_Helper</class>
            </netregistry>
        </helpers>        
    </global>
    <default>
        <payment>
            <netregistry>
                <active>0</active>
                <model>netregistry/netregistry</model>
                <order_status>1</order_status>
                <title>Net Registry</title>
                <allowspecific>0</allowspecific>
                <form_block_type>0</form_block_type>
            </netregistry>
        </payment>
    </default>
    <adminhtml>
        <translate>
            <modules>
                <EM_Netregistry>
                    <files>
                        <default>EM_Netregistry.csv</default>
                    </files>
                </EM_Netregistry>
            </modules>
        </translate>
    </adminhtml>
    <frontend>
        <routers>
            <netregistry>
                <use>standard</use>
                <args>
                    <module>EM_Netregistry</module>
                    <frontname>customcard</frontname>
                </args>
            </netregistry>
        </routers>
        <translate>
            <modules>
                <EM_Netregistry>
                    <files>
                        <default>EM_Netregistry.csv</default>
                    </files>
                </EM_Netregistry>
            </modules>
        </translate>
    </frontend>
    <default>
        <payment>
            <netregistry>
                <title>Net Registry</title>
                <active>1</active>
                <order_status>pending</order_status>
                <allowspecific>0</allowspecific>
                <payment_action>authorize</payment_action>
                <show_bank_accounts_in_pdf>1</show_bank_accounts_in_pdf>
                <show_customtext_in_pdf>1</show_customtext_in_pdf>
            </netregistry>
        </payment>
    </default>
</config>

This is my system.xml:

<?xml version="1.0"?>
<config>
    <sections>
        <payment>
            <groups>
                <netregistry translate="label" module="netregistry">
                    <label>Net Registry</label>
                    <frontend_type>text</frontend_type>
                    <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>
                    <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>
                        <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>
                        <merchant_id translate="label">
                            <label>Merchant ID</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>
                        </merchant_id>
                        <merchant_pass translate="label">
                            <label>Password</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>1</show_in_store>
                        </merchant_pass>
                        <allowspecific translate="label">
                            <label>Payment from applicable countries</label>
                            <frontend_type>allowspecific</frontend_type>
                            <sort_order>5</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>1</show_in_store>
                        </allowspecific>
                        <specificcountry translate="label">
                            <label>Payment from Specific countries</label>
                            <frontend_type>multiselect</frontend_type>
                            <sort_order>6</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>1</show_in_store>
                        </specificcountry>
                    </fields>
                </netregistry>
            </groups>
        </payment>
    </sections>
</config>

This is my model model/Netregistry.php:

/**
* Our test CC module adapter
*/
class EM_Netregistry_Model_Netregistry extends Mage_Payment_Model_Method_Cc
{

    protected $_code = 'netregistry';
    protected $_formBlockType = 'netregistry/form';
    protected $_infoBlockType = 'netregistry/form';

}

And this is my form.php in my Block folder:

class EM_Netregistry_Block_Form extends Mage_Payment_Block_Form
{
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('netregistry/form.phtml');
    }
}
2
  • Why do you set the same value to $_formBlockType and $_infoBlockType ? Commented Feb 18, 2013 at 15:58
  • i have remove $_infoBlockType still not working
    – user482
    Commented Feb 19, 2013 at 5:22

2 Answers 2

1

Please use this code for your model extended class is wrong Mage_Payment_Model_Method_Cc use this Mage_Payment_Model_Method_Abstract

<?php

/**
* Our test CC module adapter
*/
class EM_Netregistry_Model_Netregistry extends Mage_Payment_Model_Method_Abstract
{

    protected $_code = 'netregistry';
    protected $_formBlockType = 'netregistry/form';
    protected $_infoBlockType = 'netregistry/form';

}
4

If config in admin is missing check if you have properly created bootstrap file in etc/modules. It's missing here, maybe this is the reason.

Also you are missing model declaration in config.xml

<default>
   <payment>
      <netregistry>
          <model>.....

Noticed you have double <default><payment><netregistry> nodes. Try to merge them.
Add following code to your payment model

    public function isAvailable($quote = null)
    {
        return true;
    }

Display logic lies in Mage_Payment_Helper_Data method getStoreMethods. Try to debug this cycle.

5
  • please read my question again i have added it in config.xml
    – user482
    Commented Feb 18, 2013 at 13:20
  • and configuration part is working in admin problem with frontend onecheckout page where its not showing i have enabled it
    – user482
    Commented Feb 18, 2013 at 13:21
  • Well, I've read config again. And noticed that <payment> section is doubled. Second declaration is missing <model>
    – Sergey
    Commented Feb 18, 2013 at 13:24
  • still not working
    – user482
    Commented Feb 18, 2013 at 13:30
  • see responce update
    – Sergey
    Commented Feb 18, 2013 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.