xml - 将自定义字段添加到 paypal 模块 magento 1.9

标签 xml magento paypal magento-1.9

我需要在 paypal 配置中添加一个额外的字段,但由于教皇配置中使用了“无限”组,我无法添加它。是否可以向核心 paypal v.1.6.0.6 magento 1.9 模块添加自定义字段?

我正在我的自定义模块的 system.xml 文件中尝试使用以下代码,但没有成功。同一 xml 中的 cashondelivery 选项工作正常。

任何帮助将不胜感激

<?xml version="1.0"?>
<config>
    <sections>
        <payment>
            <groups>
                <paypal_payments>
                    <payments_pro_hosted_solution translate="label comment">
                        <fields>
                            <pphs_required_settings translate="label">
                                <fields>
                                    <pphs_required_settings_pphs translate="label">
                                        <fields>
                                            <charge_type translate="label">
                                                <label>Payment Charge Type</label>
                                                <frontend_type>select</frontend_type>
                                                <source_model>paymentcharge/system_config_source_chargetype</source_model>
                                                <sort_order>22</sort_order>
                                                <show_in_default>1</show_in_default>
                                                <show_in_website>1</show_in_website>
                                                <show_in_store>0</show_in_store>
                                            </charge_type>
                                            <charge_value translate="label">
                                                <label>Payment Charge</label>
                                                <frontend_type>text</frontend_type>
                                                <sort_order>24</sort_order>
                                                <show_in_default>1</show_in_default>
                                                <show_in_website>1</show_in_website>
                                                <show_in_store>0</show_in_store>
                                            </charge_value>
                                        </fields>
                                    </pphs_required_settings_pphs>
                                </fields>
                            </pphs_required_settings>
                        </fields>
                    </payments_pro_hosted_solution>
                </paypal_payments>
                <cashondelivery translate="label">
                    <fields>
                        <charge_type translate="label">
                            <label>Payment Charge Type</label>
                            <frontend_type>select</frontend_type>
                            <source_model>paymentcharge/system_config_source_chargetype</source_model>
                            <sort_order>200</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </charge_type>
                        <charge_value translate="label">
                            <label>Payment Charge</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>201</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </charge_value>
                    </fields>
                </cashondelivery>
            </groups>
        </payment>
    </sections>
</config>

这里是 magento 1.9 system.xml 文件的官方 paypal 模块 v 1.6.0.6

https://github.com/mgtf/magento-1.9.2.0/blob/master/app/code/core/Mage/Paypal/etc/system.xml

最佳答案

试试这个

<?xml version="1.0"?>
<config>
    <sections>
        <payment>
            <groups>
                <paypal_payments>
                    <payments_pro_hosted_solution translate="label comment">
                        <fields>
                            <pphs_required_settings translate="label">
                                <fields>
                                    <pphs_required_settings_pphs translate="label">
                                    <label>Payments Pro Hosted Solution</label>
                                        <show_in_default>1</show_in_default>
                                        <show_in_website>1</show_in_website>
                                        <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model>
                                        <sort_order>10</sort_order>
                                        <fields>
                                            <charge_type translate="label">
                                                <label>Payment Charge Type</label>
                                                <frontend_type>select</frontend_type>
                                                <source_model>paymentcharge/system_config_source_chargetype</source_model>
                                                <sort_order>22</sort_order>
                                                <show_in_default>1</show_in_default>
                                                <show_in_website>1</show_in_website>
                                                <show_in_store>0</show_in_store>
                                            </charge_type>
                                            <charge_value translate="label">
                                                <label>Payment Charge</label>
                                                <frontend_type>text</frontend_type>
                                                <sort_order>24</sort_order>
                                                <show_in_default>1</show_in_default>
                                                <show_in_website>1</show_in_website>
                                                <show_in_store>0</show_in_store>
                                            </charge_value>
                                        </fields>
                                    </pphs_required_settings_pphs>
                                </fields>
                            </pphs_required_settings>
                        </fields>
                    </payments_pro_hosted_solution>
                </paypal_payments>
                <cashondelivery translate="label">
                    <fields>
                        <charge_type translate="label">
                            <label>Payment Charge Type</label>
                            <frontend_type>select</frontend_type>
                            <source_model>paymentcharge/system_config_source_chargetype</source_model>
                            <sort_order>200</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </charge_type>
                        <charge_value translate="label">
                            <label>Payment Charge</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>201</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </charge_value>
                    </fields>
                </cashondelivery>
            </groups>
        </payment>
    </sections>
</config>

关于xml - 将自定义字段添加到 paypal 模块 magento 1.9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58234178/

相关文章:

php - Magento 或 Prestashop DB 外部连接

php - 将产品添加到购物车后获取报价项目 ID

php - 使用 POST 从 PHP 页面将自定义购物车上传到 Paypal

angular - Angular 2 组件中的 PayPal 快速结账 - 加载问题?

xml - 使用 WebInvoke 在 WCF REST 服务主体中传递 XML 字符串

java - 如何让我的 Java Servlet 类处理 SAXException?

php - 自定义报告Magento中与时区的区别

xml - 与多行 XML 案例匹配的模式

javascript - 如何在 javascript 中使用 XML?

paypal - 3D Security 使用 Paypal 为美国商户帐户