新的支付方式在新的配置选项卡在Magento


New Payment Method in New Configuration Tab in Magento

我想做的就是添加一个新的自定义支付方式,并使其在新的配置选项卡中可用,而不是"Sales/payment Methods"

例如,我想有我的支付方式在"CompanyName/Method1"在管理配置,而不是有一个组在"销售/支付方式"。

我的问题出现在这里。我可以设置system.xml文件有一个新的选项卡和我的模块选项在它下面。但是当我更改config.xml时,我的付款方式不再显示在结帐页面中。

当我更改为自定义选项卡名称时,它无法在结帐时显示。什么好主意吗?

<default>
        <payment>
            <spos>
                <active>0</active>
                <model>spos/payment</model>
                <order_status>1</order_status>
                <title>SPos</title>
                <payment_action>authorize</payment_action>
                <allowspecific>0</allowspecific>
            </spos>
        </payment>
</default>

http://alanstorm.com/custom_magento_system_configuration

我认为您需要显示您的config.xml和system.xml。我已经尝试过了,我的xml如下:

System.xml

<?xml version="1.0"?>
<config>
    <tabs>
        <newmodule translate="label" module="newmodule">
            <label>NewModule</label>
            <sort_order>200</sort_order>
        </newmodule>
    </tabs>
    <sections>
        <newmodule translate="label" module="newmodule">
            <label>NewModule</label>
            <tab>newmodule</tab>
            <frontend_type>text</frontend_type>
            <sort_order>0</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <newmodule translate="label" module="paygate">
                    <label>NewModule Payment</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>
                        <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>4</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>
                        <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>0</show_in_store>
                        </title>
                    </fields>
                </newmodule>
            </groups>
        </newmodule>
    </sections>
</config>  

config . xml

<?xml version="1.0"?>
<config>
    <modules>
        <NameSpace_NewModule>
            <version>0.1.0</version>
        </NameSpace_NewModule>
    </modules>
    <frontend>
        <routers>
            <newmodule>
                <use>standard</use>
                <args>
                    <module>NameSpace_NewModule</module>
                    <frontName>newmodule</frontName>
                </args>
            </newmodule>
        </routers>
        <layout>
            <updates>
                <newmodule>
                    <file>newmodule.xml</file>
                </newmodule>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <newmodule>
                <use>admin</use>
                <args>
                    <module>NameSpace_NewModule</module>
                    <frontName>newmodule</frontName>
                </args>
            </newmodule>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <newmodule module="newmodule">
                <title>NewModule</title>
                <sort_order>71</sort_order>
                <action>newmodule/adminhtml_newmodule</action>
                <children>
                    <marketing module="newmodule">
                        <title>Marketing</title>
                        <sort_order>0</sort_order>
                        <action>newmodule/adminhtml_newmodule</action>
                    </marketing>                    
                </children>
            </newmodule>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <newmodule>
                            <title>NewModule</title>
                            <sort_order>1</sort_order>
                            <action>newmodule/adminhtml_newmodule</action>
                            <children>
                            <marketing module="newmodule">
                                <title>Marketing</title>
                                <sort_order>0</sort_order>
                                <action>newmodule/adminhtml_newmodule</action>
                            </marketing>                           
                            </children>
                        </newmodule>
                    </children>
                </admin>
            </resources>
        </acl>
        <layout>
            <updates>
                <newmodule>
                    <file>newmodule.xml</file>
                </newmodule>
            </updates>
        </layout>
    </adminhtml>
    <global>
        <fieldsets>
            <sales_convert_quote_payment>
                <newmodule_id>
                    <to_order_payment>*</to_order_payment>
                </newmodule_id>               
                <order_cash_value>
                    <to_order_payment>*</to_order_payment>
                </order_cash_value>
            </sales_convert_quote_payment>
            <sales_convert_order_payment>
                <budget_id>
                    <to_quote_payment>*</to_quote_payment>
                </budget_id>                
                <order_cash_value>
                    <to_quote_payment>*</to_quote_payment>
                </order_cash_value>
            </sales_convert_order_payment>
        </fieldsets>
        <models>
            <newmodule>
                <class>NameSpace_NewModule_Model</class>
                <resourceModel>newmodule_mysql4</resourceModel>
            </newmodule>
            <newmodule_mysql4>
                <class>NameSpace_NewModule_Model_Mysql4</class>
                <entities>
                    <newmodule>
                        <table>newmodule</table>
                    </newmodule>                    
                </entities>
            </newmodule_mysql4>
        </models>
        <resources>
            <newmodule_setup>
                <setup>
                    <module>NameSpace_NewModule</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </newmodule_setup>
            <newmodule_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </newmodule_write>
            <newmodule_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </newmodule_read>
        </resources>
        <blocks>
            <newmodule>
                <class>NameSpace_NewModule_Block</class>
            </newmodule>
        </blocks>
        <helpers>
            <newmodule>
                <class>NameSpace_NewModule_Helper</class>
            </newmodule>
        </helpers>
    </global>
    <default>
        <payment>
            <newmodule>
                <active>1</active>
                <model>newmodule/payment_newmodule</model>
                <order_status>processing</order_status>
                <title>NewModule Payment</title>
                <payment_action>authorize</payment_action>
            </newmodule>
        </payment>
    </default>
</config>

希望这对你有帮助。

您必须将<config_path>payment/[YourGroupName]/[FieldName]</config_path>节点添加到新组部分下的每个新支付字段中。字段在system。xml文件中是这样的:

...
    <fields>
        <active translate="label">
            <label>Enabled</label>
            <config_path>payment/method1/active</config_path>
            <frontend_type>select</frontend_type>
            <source_model>adminhtml/system_config_source_yesno</source_model>
            <sort_order>10</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>
            <config_path>payment/method1/title</config_path>
            <frontend_type>text</frontend_type>
            <sort_order>15</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>0</show_in_website>
            <show_in_store>1</show_in_store>
        </title>
        .
        .
        .
    </fields>
...

PayPal模块在Magento是一个很好的参考检查,学习和发现新的东西的支付方式。