Skip to content

Instantly share code, notes, and snippets.

@bluec
bluec / export_categories.php
Created November 28, 2016 13:17
Export Magento category tree with full names, paths and URLs
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
@haruair
haruair / gist:b8ff4fb128488f5e1dbf
Last active May 6, 2018 22:28
How to get all category tree node in Magento
<?php
// Usually, you can get category tree from category helper
$helper = Mage::helper('catalog/category');
$nodes = $helper->getStoreCategories();
// return Varien_Data_Tree_Node_Collection
// via Mage_Catalog_Model_Resource_Category
// However, this get method return active category only.
// Most of the samples are for collection of the category.