Magento 新配置选项卡中的新付款方式

发布于 2024-12-22 17:01:57 字数 752 浏览 0 评论 0原文

我想要做的就是添加新的自定义付款方式并使其在新的配置选项卡中可用,而不是“销售/付款方式”。

例如,我希望在管理配置中的“公司名称/方法1”下设置我的付款方式,而不是在“销售/付款方式”下设置一个组。

我的问题就出现在这里。我可以设置 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>

All I want to do is to add a new custom payment method and make it available in a new configuration tab, instead of "Sales/Payment Methods".

For example I want to have my payment method under "CompanyName/Method1" in admin configuration instead of having a group under "Sales/Payment Methods".

My problem arises here. I can set up the system.xml file to have a new tab and my module options under it. But when I change config.xml, my payment method does not show up in the chekout page anymore.

When I change to my custom tab name, it fails to show up in checkout. Any ideas?

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不必了 2024-12-29 17:01:57

我认为你需要显示你的 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>

希望这可以帮助您。检查这些 xml 并进行比较。

I think you need to show your config.xml and system.xml. I have tried for this and my xmls are as follows:

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>

Hope this may help you. Check these xmls and compare it..

ゝ偶尔ゞ 2024-12-29 17:01:57

您必须将 payment/[YourGroupName]/[FieldName] 节点添加到新组部分下的每个新付款字段。
因此,您的 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>
...

Magento 中的 PayPal 模块是检查、学习和查找付款方式新内容的一个很好的参考。

You must add <config_path>payment/[YourGroupName]/[FieldName]</config_path> node to each new payment's field which is under your new group section.
So your fields are something look like this in your system.xml file:

...
    <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 module in Magento is a vary good reference to check, learn and find new things for payment methods.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文