質問

支払いモジュールを作成しましたが、チェックアウトページでレンダリングされていません。 configuration -> payment methods.

これは私の 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>

これは私の 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>

これが私のモデルです 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';

}

そして、これは私です form.php 私のブロックフォルダーで:

class EM_Netregistry_Block_Form extends Mage_Payment_Block_Form
{
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('netregistry/form.phtml');
    }
}
役に立ちましたか?

解決

モデル拡張クラスが間違っているためにこのコードを使用してください Mage_Payment_Model_Method_Cc これを使って 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';

}

他のヒント

管理者が不足している場合、etc/モジュールでBootstrapファイルを適切に作成した場合、チェックをチェックします。ここには欠けているのかもしれませんが、これが理由かもしれません。

また、config.xmlのモデル宣言がありません

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

ダブルがあることに気づきました <default><payment><netregistry> ノード。それらをマージしてみてください。
支払いモデルに次のコードを追加します

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

表示ロジックはにあります Mage_Payment_Helper_Data 方法 getStoreMethods. 。このサイクルをデバッグしてみてください。

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top