Skip to content

Cannot add additional field to Newsletter system configuration at desired position #19418

Closed
@vasilii-b

Description

@vasilii-b

Summary (*)

Environment: Magento 2.2-develop, Magento 2.3-develop
As a Magento developer, I want to add some additional settings to the Newsletter system configuration before Success Email Template (as example).

Examples (*)

Within a custom module, in the adminhtml/system.xml file, add a new field before Success Email Template, like following:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="newsletter">
            <tab>customer</tab>
            <group id="subscription">
                <field id="custom_field" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Do some more stuff after subscription ?</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

Actual results
With given above, the custom field will appear at the end of fields list in scope of Newsletter system configuration.

Expected result
Newly added field should be sorted according to given sortOrder value.

*The issue
The problem is that in the app/code/Magento/Newsletter/etc/adminhtml/system.xml group fields has sortOrder the same - 1.

Proposed solution

In the app/code/Magento/Newsletter/etc/adminhtml/system.xml group fields has sortOrder with a step of 10. So each additional field will get previous sortOrder value + 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: NewsletterFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedProgress: PR CreatedIndicates that Pull Request has been created to fix issueReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions