1

Magento版を使用しています。1.6.2.0

新しい支払い方法を作成するための公式ガイドを読みました: http://www.magentocommerce.com/wiki/5_-_modules_and_development/payment/create-payment-method-module

ディレクトリに、app/etc/modulesこのxmlファイルを作成しましたMyName_MyModule:

<?xml version="1.0" encoding="UTF-8"?>
<config>  
<modules>  
    <MyName_MyModule>  
        <active>true</active>
        <codePool>local</codePool>  
    </MyName_MyModule>  
</modules>  

app/code/local私はこのフォルダを作成しましたMyName/MyModuleMyName/MyModule/etc MyName/MyModule/Model

MyName/MyModule/etcには(config.xml)があります:

<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
    <MyName_MyModule>
        <version>0.1.0</version>
    </MyName_MyModule>
</modules>
<global>
    <models>
        <mymodule>
            <class>MyName_MyModule_Model</class>
        </mymodule>
    </models>
    <resources>
        <mymodule_setup>
            <setup>
                <module>MyName_MyModule</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </mymodule_setup>
        <mymodule_write>
            <connection>
                <use>core_write</use>
            </connection>
        </mymodule_write>
        <mymodule_read>
            <connection>
                <use>core_read</use>
            </connection>
        </mymodule_read>
    </resources>     
</global>

および system.xml:

<?xml version="1.0"?>
<config>
<sections>
    <payment>
        <groups>
            <mymodule translate="label" module="payment">
                <label>My Module</label>
                <sort_order>670</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>6</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>0</show_in_store>
                    </title>
                </fields>
            </mymodule>
        </groups>
    </payment>
</sections>

問題は:

パネル管理に支払い方法が表示されます システム/詳細にも表示されます

支払い方法を有効にして何かを購入しようとすると、支払い情報に表示されません。

ラジオ ボタンが 2 つしか表示されない:
小切手 / マネー オーダー クレジット カード (保存済み)

キャッシュを手動でクリアし、管理パネルから無効にしました。

追加されたデフォルト:

        <!-- declare default configuration values for this module -->
    <default>
        <!-- 'payment' configuration section (tab) -->
        <payment>
            <!-- 'newmodule' configuration group (fieldset) -->
            <mymodule>
                <!-- by default this payment method is inactive -->
                <active>1</active>
                <!-- model to handle logic for this payment method -->
                <model>mymodule/paymentMethod</model>
                <!-- order status for new orders paid by this payment method -->
                <order_status>pending</order_status>
                <!-- default title for payment checkout page and order view page -->
                <title>My Module</title>

                <payment_action>authorize</payment_action>
                <allowspecific>0</allowspecific>
            </mymodule>
        </payment>
    </default>

それでもうまくいきません!

4

2 に答える 2

0

これが役立つことを願っています。あなたの config.xml ファイルにいくつかの構成が欠けていると思います。このリンクを参照してくださいhttp://inchoo.net/ecommerce/magento/how-to-create-magento-payment-module/

于 2013-09-20T11:17:45.183 に答える
0

config xml に追加するのを忘れている

 <default>
<!-- 'payment' configuration section (tab) -->
        <payment>
<!-- 'newmodule' configuration group (fieldset) -->
            <newmodule>
<!-- by default this payment method is inactive -->
                <active>0</active>
<!-- model to handle logic for this payment method -->
                <model>newmodule/paymentMethod</model>
<!-- order status for new orders paid by this payment method -->
                <order_status>pending</order_status>
<!-- default title for payment checkout page and order view page -->
                <title>Credit Card (Authorize.net)</title>

                <cctypes>AE,VI,MC,DI</cctypes>
                <payment_action>authorize</payment_action>
                <allowspecific>0</allowspecific>
            </newmodule>
         </payment>
    </default>

これがないと、支払いページに支払いオプションが表示されません。

これで問題が解決することを願っています。

于 2013-09-20T11:14:01.593 に答える