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/MyModule 并且:MyName/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://inhoo.net/ecommerce/magento/how-to-create-magento-payment-module/

于 2013-09-20T11:17:45.183 回答
0

您忘记添加配置 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 回答