diff --git a/setup/src/Magento/Setup/Fixtures/StoresFixture.php b/setup/src/Magento/Setup/Fixtures/StoresFixture.php index fd694bc35de2ce86667d2b487d631714ef170aa9..21b0da0d01a9acaa3e425ccb218d9b66fe54d5a2 100644 --- a/setup/src/Magento/Setup/Fixtures/StoresFixture.php +++ b/setup/src/Magento/Setup/Fixtures/StoresFixture.php @@ -33,7 +33,6 @@ class StoresFixture extends Fixture /** @var \Magento\Store\Model\StoreManager $storeManager */ $storeManager = $this->fixtureModel->getObjectManager()->create('Magento\Store\Model\StoreManager'); /** @var $category \Magento\Catalog\Model\Category */ - $category = $this->fixtureModel->getObjectManager()->create('Magento\Catalog\Model\Category'); /** @var $defaultWebsite \Magento\Store\Model\Website */ $defaultWebsite = $storeManager->getWebsite(); @@ -76,19 +75,18 @@ class StoresFixture extends Fixture //Create $storeGroupsCount websites $websiteNumber = 0; for ($i = 0; $i < $storeGroupsCount; $i++) { + $category = $this->fixtureModel->getObjectManager()->create('Magento\Catalog\Model\Category'); $websiteId = $websitesId[$websiteNumber]; $groupId = null; - $parentCategoryId = null; $categoryPath = '1'; $storeGroupName = sprintf('Store Group %d - website_id_%d', $i + 1, $websiteId); if ($i == 0 && $websiteId == $defaultWebsiteId) { $groupId = $defaultStoreGroupId; - $parentCategoryId = $defaultParentCategoryId; $categoryPath = '1/' . $defaultParentCategoryId; + $category->load($defaultParentCategoryId); } - $category->load($parentCategoryId); $category->setName("Category $storeGroupName") ->setPath($categoryPath)