I export all category with tree path my Magento site using following script:

//Import Magento  All category script
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';

$category = Mage::getModel ('catalog/category');
$tree = $category->getTreeModel();
$ids = $tree->getCollection()->getAllIds();
$categories = array();
$x = 0;

if ($ids) {
//Need Create import directory if not exist 
    $file = "var/import/catwithid.csv";
    file_put_contents($file,'"id","name","path","path_ids","url"' . PHP_EOL);
    foreach ( $ids as $id ) {
        $url_key = Mage::helper('catalog/category')->getCategoryUrlPath($category->getUrlPath(), true);
        $path = explode('/', $categories[$id]['path']);
        $fpath = '';
        foreach ($path as $pathId) {
            $fpath .= $categories[$pathId]['name'] . '/';

        $path_ids = implode(',', $path);
        $string = '"' . $id . '","' . $category->load($id)->getName() . '","' . $fpath . '","' . $path_ids . '"' . $url_key . '"' . PHP_EOL;



Now I want to Import another fresh install magento site.

enter image description here

closed as unclear what you're asking by Sander Mangel, 7ochem, liyakat, Anna Völkl, brentwpeterson Nov 10 '15 at 13:00

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


If you want to import all categories and products to your website, just follow the following instructions.

  1. First of all, create all categories and create one product in your website
  2. After this, export that data and keep that with you.
  3. Now arrange the data which you want to import, that total have to be arrange in the format of your exported data.
  4. After arranged you can easily import the data into your website which you want to import newly in usual manner.

Note : After import the data, you need to reindex.

Not the answer you're looking for? Browse other questions tagged or ask your own question.