可能であれば、製品の編集タブにあるデフォルトのカテゴリ ツリーを上書きするために、カスタム管理モジュールのカテゴリとサブ カテゴリのカテゴリ ツリーを構築しようとしています。
以下は私が取り組んでいるコードです。カテゴリ ツリーを作成することはできますが、チェックボックス機能がありません。任意の提案をいただければ幸いです
<?php
$rootcatId= Mage::app()->getStore()->getRootCategoryId();
$categories = Mage::getModel('catalog/category')->getCategories($rootcatId);
function get_categories($categories) {
$array= '<ul>';
foreach($categories as $category) {
$cat = Mage::getModel('catalog/category')->load($category->getId());
$count = $cat->getProductCount();
$array .= '<li>'.
'<a href="' . Mage::getUrl($cat->getUrlPath()). '">' .
$category->getName() . "(".$count.")</a>\n";
if($category->hasChildren()) {
$children = Mage::getModel('catalog/category')->getCategories($category->getId());
$array .= get_categories($children);
}
$array .= '</li>';
}
return $array . '</ul>';
}
echo get_categories($categories); ?>