我想从多商店网站获取特定商店的所有级别类别。我怎样才能得到这个。
直到现在我一直遵循这个
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app("default");
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
$ids = $tree->getCollection()->getAllIds();
$path = Mage::getBaseDir();
$fp = fopen($path.'/media/stageAllLevelCategories.csv','w');
if ($ids)
{
foreach ($ids as $id)
{
$cat = Mage::getModel('catalog/category');
$cat->load($id);
if($id != 3):
$name = $cat->getName();
echo " ";
$catId = $cat->getId();
echo "</br>";
fputcsv($fp,array($name,$catId ),',','"');
endif;
}
}
fclose($fp);
?>