Skip to content

Instantly share code, notes, and snippets.

@paulmouzas
Last active September 28, 2015 18:20
Show Gist options
  • Save paulmouzas/847fe3a850e21bb9d43e to your computer and use it in GitHub Desktop.
Save paulmouzas/847fe3a850e21bb9d43e to your computer and use it in GitHub Desktop.
update_categories.php
<?php
require_once 'app/Mage.php';
Mage::app();
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
$ids = $tree->getCollection()->getAllIds();
if ($ids){
foreach ($ids as $id){
$cat = Mage::getModel('catalog/category');
$cat->load($id);
$entity_id = $cat->getId();
$name = $cat->getName();
$url_key = $cat->getUrlKey();
$url_path = $cat->getUrlPath();
$level = $cat->getLevel();
echo $entity_id . ": " . $name . "-> " . $level . "\n";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment