/** * Create new Magento category with given $name. * * @param string $name * @return int ID of the created category */ public function createMageCategory($name) { /** @var $category CategoryInterface */ $category = $this->_manObj->create(CategoryInterface::class); $category->setName($name); $category->setIsActive(false); $saved = $this->_mageRepoCategory->save($category); $result = $saved->getId(); return $result; }
/** * @param string $blockId * @param string $categoryId * @return void */ protected function setCategoryLandingPage($blockId, $categoryId) { $categoryCms = ['landing_page' => $blockId, 'display_mode' => 'PRODUCTS_AND_PAGE']; if (!empty($categoryId)) { $category = $this->categoryRepository->get($categoryId); $category->setData($categoryCms); $this->categoryRepository->save($categoryId); } }