Skip to content

Commit d5a54e3

Browse files
committed
Merge branch 'MDVA-237' into 2.0.5_backlog
2 parents f55e603 + 7f46912 commit d5a54e3

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

app/code/Magento/Catalog/Setup/InstallData.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ class InstallData implements InstallDataInterface
2222
*/
2323
private $categorySetupFactory;
2424

25+
/**
26+
* Root category ID
27+
*
28+
* @var int
29+
*/
30+
const ROOT_CATEGORY_ID = 1;
31+
32+
/**
33+
* Default category ID
34+
*
35+
* @var int
36+
*/
37+
const DEFAULT_CATEGORY_ID = 2;
38+
2539
/**
2640
* Init
2741
*
@@ -46,28 +60,29 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
4660
$categorySetup->installEntities();
4761
// Create Root Catalog Node
4862
$categorySetup->createCategory()
49-
->load(1)
50-
->setId(1)
63+
->load(self::ROOT_CATEGORY_ID)
64+
->setId(self::ROOT_CATEGORY_ID)
5165
->setStoreId(0)
52-
->setPath('1')
66+
->setPath(self::ROOT_CATEGORY_ID)
5367
->setLevel(0)
5468
->setPosition(0)
5569
->setChildrenCount(0)
5670
->setName('Root Catalog')
5771
->setInitialSetupFlag(true)
5872
->save();
5973

74+
// Create Default Catalog Node
6075
$category = $categorySetup->createCategory();
61-
62-
$categorySetup->createCategory()
76+
$category->load(self::DEFAULT_CATEGORY_ID)
77+
->setId(self::DEFAULT_CATEGORY_ID)
6378
->setStoreId(0)
64-
->setPath('1')
79+
->setPath(self::ROOT_CATEGORY_ID . '/' . self::DEFAULT_CATEGORY_ID)
6580
->setName('Default Category')
6681
->setDisplayMode('PRODUCTS')
67-
->setAttributeSetId($category->getDefaultAttributeSetId())
6882
->setIsActive(1)
6983
->setLevel(1)
7084
->setInitialSetupFlag(true)
85+
->setAttributeSetId($category->getDefaultAttributeSetId())
7186
->save();
7287

7388
$data = [

app/code/Magento/Store/Setup/InstallSchema.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\Setup\ModuleContextInterface;
1111
use Magento\Framework\Setup\SchemaSetupInterface;
1212
use \Magento\Framework\DB\Ddl\Table;
13+
use \Magento\Catalog\Setup\InstallData;
1314

1415
/**
1516
* @codeCoverageIgnore
@@ -259,7 +260,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
259260
'group_id' => 1,
260261
'website_id' => 1,
261262
'name' => 'Main Website Store',
262-
'root_category_id' => 2,
263+
'root_category_id' => InstallData::DEFAULT_CATEGORY_ID,
263264
'default_store_id' => 1
264265
]
265266
);

0 commit comments

Comments
 (0)