Skip to content

Import of RootCategoryId should be possbile (Magento/Store/Model/Config/Importer/Processor/Create.php) #18956

@larsroettig

Description

@larsroettig

Description (*)

Currently is not possible to define the root_category_id in the Project config.php

Repro

  • Create a config.php like
  • Run bin/magento -n app:config:import
    'scopes' => [
        'websites' => [
            'admin' => [
                'website_id' => '0',
                'code' => 'admin',
                'name' => 'Admin',
                'sort_order' => '0',
                'default_group_id' => '0',
                'is_default' => '0'
            ],
            'de' => [
                'website_id' => '2',
                'code' => 'de',
                'name' => 'DE',
                'sort_order' => '10',
                'default_group_id' => '2',
                'is_default' => '1'
            ]
        ],
        'groups' => [
            [
                'group_id' => '0',
                'website_id' => '0',
                'code' => 'default',
                'name' => 'Default',
                'root_category_id' => '0',
                'default_store_id' => '0'
            ],
            [
                'group_id' => '2',
                'website_id' => '2',
                'code' => 'de',
                'name' => 'DE',
                'root_category_id' => '2',
                'default_store_id' => '2'
            ]
        ],
        'stores' => [
            'admin' => [
                'store_id' => '0',
                'code' => 'admin',
                'website_id' => '0',
                'group_id' => '0',
                'name' => 'Admin',
                'sort_order' => '0',
                'is_active' => '1'
            ],
            'de_de' => [
                'store_id' => '2',
                'code' => 'de',
                'website_id' => '2',
                'group_id' => '2',
                'name' => ' de DE',
                'sort_order' => '10',
                'is_active' => '1'
            ]
        ]
    ]

Expected behavior (*)

  • Import of root_category_id is successfully

Benefits

  • Simple Store setup for Projects

Additional information

In the import Class will the root category set hardcoded to 0 see:

$website = $this->detectWebsiteById(
$data,
$websiteId
);
$group = $this->groupFactory->create();
$group->setData($groupData);
$group->setRootCategoryId(0);
$group->getResource()->save($group);
$group->getResource()->addCommitCallback(function () use ($data, $group, $website) {

Metadata

Metadata

Assignees

Labels

Component: ConfigComponent: StoreFixed 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: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced 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