Hai
Is there any approach import bulk categories?Can you please suggest if any?
Hai
Is there any approach import bulk categories?Can you please suggest if any?
What’s your starting point? Does your catgeory data have any tree structure?
Do you need to know how to save a category in code? e.g.:
`
$category = $this->categoryFactory->create([
'data' => [
"parent_id" => $parentCategoryId,
"name" => 'The Category name',
"is_active" => true,
"position" => 2,
"include_in_menu" => true,
]
]);
$category->setCustomAttributes([
"display_mode"=> "PRODUCTS",
"is_anchor"=> "1",
"custom_use_parent_settings"=> "0",
"custom_apply_to_products"=> "0",
"automatic_sorting"=> "0",
'url_key' => 'some_url_key',
'url_path' => 'some_url_path'
]);
$categoryRepo = $categoryRepositoryFactory->create();
try {
$newCategory = $categoryRepo->save($category);
} catch (CouldNotSaveException $e) {
throw new \Exception($e->getMessage().'('.$category->getUrlKey().')');
}
`