/ Published in: PHP
Simply save the above code in a PHP file in the base Magento directory of your store, and visit the URL in your web browser, simples!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php 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/import/catwithid.csv"; foreach ( $ids as $id ) { $string = $id . ', ' .$category->load($id)->getName() . "\n"; } } ?>
URL: http://www.sonassi.com/knowledge-base/quick-script-to-export-categories-with-ids/