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

Add custom field to paypal module magento 1.9

我需要在 paypal 配置中添加一个额外的字段,但是由于 "infinite" papal 配置中使用的组,我无法添加它。是否可以向核心 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 的官方 paypal 模块 v 1.6.0.6 system.xml 文件

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>