<?php
ini_set('memory_limit', '-1');
set_time_limit(0);
require_once('app/Mage.php');
umask(0);
Mage::app('default');
define('MAGENTO', realpath(dirname(__FILE__)));
$file_path = MAGENTO . '/var/export/catwithid.csv';
$mage_csv = new Varien_File_Csv();
$products_row = array();
$products_row['0']['categoryid'] = 'categoryid';
$products_row['0']['categoryname'] = 'categoryname';
$category = Mage::getModel ( 'catalog/category' );
$tree = $category->getTreeModel ();
$tree->load ();
$ids = $tree->getCollection ()->getAllIds ();
foreach ($ids as $id)
{
$data['categoryid'] = $id;
$data['categoryname'] = $category->load($id)->getName();
$products_row[] = $data;
}
$mage_csv->saveData($file_path, $products_row);
echo "Please find test1.csv file in your folder.....";
?>
ini_set('memory_limit', '-1');
set_time_limit(0);
require_once('app/Mage.php');
umask(0);
Mage::app('default');
define('MAGENTO', realpath(dirname(__FILE__)));
$file_path = MAGENTO . '/var/export/catwithid.csv';
$mage_csv = new Varien_File_Csv();
$products_row = array();
$products_row['0']['categoryid'] = 'categoryid';
$products_row['0']['categoryname'] = 'categoryname';
$category = Mage::getModel ( 'catalog/category' );
$tree = $category->getTreeModel ();
$tree->load ();
$ids = $tree->getCollection ()->getAllIds ();
foreach ($ids as $id)
{
$data['categoryid'] = $id;
$data['categoryname'] = $category->load($id)->getName();
$products_row[] = $data;
}
$mage_csv->saveData($file_path, $products_row);
echo "Please find test1.csv file in your folder.....";
?>