Created
December 23, 2013 18:24
-
-
Save pierreandreroy/8102136 to your computer and use it in GitHub Desktop.
Get all Magento categories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$categories = Mage::getModel('catalog/category')->getCollection() | |
->addAttributeToSelect('id') | |
->addAttributeToSelect('name') | |
->addAttributeToSelect('url_key') | |
->addAttributeToSelect('url') | |
->addAttributeToSelect('is_active'); | |
foreach ($categories as $category) | |
{ | |
if ($category->getIsActive()) { // Only pull Active categories | |
$entity_id = $category->getId(); | |
$name = $category->getName(); | |
$url_key = $category->getUrlKey(); | |
$url_path = $category->getUrl(); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment