Quick script to batch create Magento categories

A site we administer with a reasonable amount of SKUs (far in excess of 100,000), needed some quick category manipulation for a series of new data to be dropped in. The new information had a desired category tree that had to be built up quick, but with over 600 categories to be created, human effort wouldn’t be suitable. So, using the Magento category ID export script to help manipulate the CSV – we were able to quickly make a script to batch create our categories. First off, create your CSV with 2 columns, the parent ID for the category and the category name – you could easily add more columns for extra options, but it wasn’t necessary for us. The CSV file should be something like this: 3,subcat 4,subcat2 6,subcat3 Then it should be saved in ./var/import/importCats.csv Then save the following in ./quickCatCreate.php <?php define(‘MAGENTO’, realpath(dirname(__FILE__))); require_once MAGENTO . ‘/app/Mage.php’; … Continue reading