Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new fieldset to the admin category editor changes the position of the 'General' fieldset. #15041

Closed
leoquijano opened this issue May 7, 2018 · 3 comments
Labels
Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line good first issue Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@leoquijano
Copy link

Hi,

When a custom fieldset is added to the admin category editor, the General section (the one with "Enable category", "Include in Menu" and "Category Name") moves to the last position of the form.

It seems that this issue was already reported by somebody else in #5300, but it was closed. The problem remains, so I decided to open a new one.

Preconditions

I'm using Magento 2.2.3, PHP 7.1.16 and MySQL 5.7.22 with a default installation.

Steps to reproduce

Create a new module with the basic files (composer.json, etc/module.xml, registration.php, as specified in the developer documentation), and add the view/adminhtml/ui_component/category_form.xml file, with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
  <fieldset name="custom_fieldset">
    <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
        <item name="label" xsi:type="string" translate="true">Custom Fieldset</item>
        <item name="collapsible" xsi:type="boolean">true</item>
        <item name="sortOrder" xsi:type="number">200</item>
      </item>
    </argument>
  </fieldset>
</form>

There's no need to add a new category attribute. With just the new fieldset the problem appears.

Expected result

The general section, and its fields, should be at the top of the form so the category name is clearly visible:

expected result

Actual result

The general section is placed at the bottom of the form:

actual result

Workaround and possible solution

This seems to be related to the fact that the general fieldset doesn't have a configured sortOrder. In vendor/magento/module-catalog/view/adminhtml/ui_component/category_form.xml, you can see:

<fieldset name="general">
  <settings>
    <collapsible>false</collapsible>
    <label/>
  </settings>
  ...
</fieldset>

When adding a custom fieldset, somehow the fieldset gets merged in a different position of the resulting XML, giving a different display order. This can be confusing for site administrators (since the category name can be hidden below the fold if the website uses several extensions), and it's also confusing for developers.

A simple workaround is to add the sortOrder in our custom module's category_form.xml:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
  <fieldset name="custom_fieldset">
    <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
        <item name="label" xsi:type="string" translate="true">Custom Fieldset</item>
        <item name="collapsible" xsi:type="boolean">true</item>
        <item name="sortOrder" xsi:type="number">200</item>
      </item>
    </argument>
  </fieldset>

  <fieldset name="general" sortOrder="1">
  </fieldset>
</form>

A proper fix would be to add the sortOrder to the definition in the Magento_Catalog module itself. In its category_form.xml file:

<fieldset name="general" sortOrder="5">
  <settings>
    <collapsible>false</collapsible>
    <label/>
    <sortOrder>
  </settings>
  ...
</fieldset>
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label May 7, 2018
@leoquijano leoquijano changed the title Adding a new fieldset to the admin category editor, changes the position of the 'General' fieldset. Adding a new fieldset to the admin category editor changes the position of the 'General' fieldset. May 7, 2018
@engcom-backlog-nickolas engcom-backlog-nickolas added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Component: Catalog Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Jul 24, 2018
@engcom-backlog-nickolas

Hello @leoquijano, thank you for your report.
We've acknowledged the issue and added to our backlog.

@magento-engcom-team
Copy link
Contributor

Hi @leoquijano. Thank you for your report.
The issue has been fixed in #17540 by @vasilii-b in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.7 release.

magento-engcom-team added a commit that referenced this issue Aug 14, 2018
…ry editor changes the position of the 'General' fieldset #17540

 - Merge Pull Request #17540 from vasilii-b/magento2:2.2-category-form-general-fieldset-wrong-sort-order
 - Merged commits:
   1. 1e1647a
magento-engcom-team pushed a commit that referenced this issue Aug 14, 2018
…ry editor changes the position of the 'General' fieldset #17540
@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Aug 16, 2018
@magento-engcom-team
Copy link
Contributor

Hi @leoquijano. Thank you for your report.
The issue has been fixed in #17604 by @jignesh-baldha in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

magento-engcom-team added a commit that referenced this issue Aug 16, 2018
…e admin category editor changes the position of the 'General' fieldset #17604

 - Merge Pull Request #17604 from jignesh-baldha/magento2:2.3-develop-PR-port-17540
 - Merged commits:
   1. b6df8e7
magento-engcom-team pushed a commit that referenced this issue Aug 16, 2018
…e admin category editor changes the position of the 'General' fieldset #17604
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line good first issue Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

3 participants