Skip to content

children_count can become negative after deleting categories #27969

Closed
@wojtekn

Description

@wojtekn

Preconditions

  1. Install clean Magento 2.3.4

Steps to reproduce

  1. Log in into admin backend

  2. Navigate to Catalog -> Categories

  3. Click "Add Subcategory"

  4. Fill category name with "Parent 1", Save

  5. Click "Add Subcategory"

  6. Fill category name with "Child 1", Save

  7. Click "Add Subcategory"

  8. Fill category name with "Child 2", Save

  9. Click "Add Subcategory"

  10. Fill category name with "Child 3", Save. At this point this category should have level = 5
    2020-04-29_18-51-36

  11. Click on "Child 1" category

  12. Delete category

Expected result

  1. Categories are deleted and children_count for remaining categories are valid eg. catalog_category_entity look as follows:
1    3    0    2020-02-05 18:38:54    2020-04-24 10:50:38    1    0    0    2
2    3    1    2020-02-05 18:38:54    2020-04-24 10:50:38    1/2    1    1    1
15    3    2    2020-04-24 10:49:35    2020-04-24 10:50:38    1/2/15    1    2    0

Actual result

  1. Categories are deleted but children_count for remaining categories are negative - catalog_category_entity look as follows:
1    3    0    2020-02-05 18:38:54    2020-04-24 10:50:38    1    0    0    -1
2    3    1    2020-02-05 18:38:54    2020-04-24 10:50:38    1/2    1    1    -2
15    3    2    2020-04-24 10:49:35    2020-04-24 10:50:38    1/2/15    1    2    -3

screenshot

Metadata

Metadata

Labels

Component: CatalogFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.3.4Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Triage: DoneHas been reviewed and prioritized during Triage with Product Managers

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions