Showing results for 
Search instead for 
Did you mean: 

Help!!, I need to create/import 5000 categories

Help!!, I need to create/import 5000 categories





I need to create 5000 categories, in 2 levels under Default category.

Also I need to import 180000 products into these categories. For importing products I use a script that generate csv file of the products to be imported. In this csv file I want to specify categories like this: Default Category, Sub Category, SubSub Category - Meaning each product is added to 3 categories.....


Now I have been googling and I found this script which I have modified a bit.. Not sure why but it gives no info on the screen when executed. Is it .htaccess issue?

	echo "step 1<br />";
  $file = fopen("audun_cat.csv","r");
  $mageFilename = 'app/Mage.php';
  require_once $mageFilename;
  ini_set('display_errors', 1);
  echo "step 2<br />";
  Mage::register('isSecureArea', 1);
  $parentId = '2';*/
  echo "step 3<br />";
  while(! feof($file)) {
    	$read = fgetcsv($file);
    	echo $read[0] . "<br>";    	
      $category = Mage::getModel('catalog/category');
      $category->setIsAnchor(1); //for active anchor
      $parentCategory = Mage::getModel('catalog/category')->load($parentId);


How do you recommend me do it? If I need to do it manually I can say good bye to Christmas Smiley Sad


Re: Help!!, I need to create/import 5000 categories

Hi @Loginname,


Using Magento OOTB you can use the Dataflow. When you export products you'll get a category called: "category_ids"


You can import your products with the categories ID's on that field. For example: "3,4"