Copy the code below into a new file "categorywithid.php" and place this file in your root folder
define('MAGENTO', realpath(dirname(__FILE__))); require_once MAGENTO . '/app/Mage.php'; Mage::app(); $category = Mage::getModel ( 'catalog/category' ); $tree = $category->getTreeModel (); $tree->load (); $ids = $tree->getCollection ()->getAllIds (); if ($ids) { $file = "var/export/catwithid.csv"; file_put_contents($file,"catId, catName\n"); foreach ( $ids as $id ) { $string = $id . ', ' .$category->load($id)->getName() . "\n"; file_put_contents($file,$string,FILE_APPEND); } }Hit Your browser like www.YourDomain.com/categorywithid.php Thats it. You are done. Get the csv file under "var/export/catwithid.csv".
No comments:
Post a Comment