我正在使用Magento 1.81和Codewix类别手风琴菜单扩展。
代码: class Codewix_Leftmenu_Block_Navigation扩展Mage_Catalog_Block_Navigation {
protected $_leftCategories;
/**
* top level parent category for current category
*
* @var int
*/
protected $_parent;
protected function _construct()
{
$path = $this->getCurrentCategoryPath();
$parent = $path[count($path)-1];
if (!$parent) {
$parent = Mage::app()->getStore()->getRootCategoryId();
}
$this->_parent = $parent;
}
public function getBlockTitle() {
}
public $curr_class ="main-categ";
public function get_categories($categories) {
$i=0;
$helper = Mage::helper('catalog/category');
if($i==0) {
$ul_id="outer_ul";
} else {
$ul_id="inner_ul";
}
$array= '<ul id="'.$ul_id.'" class="'.$this->curr_class.'">';
$this->i++;
foreach($categories as $category) {
$cat = Mage::getModel('catalog/category')->load($category->getId());
if($category->getId() != 1) {
if($this->isCategoryActive($category)) {
$this->curr_class = "current";
} else {
$this->curr_class = "main-categ";
}
if($category->hasChildren()) {
} else {
}
$array .= '<li id="big-categ" style="background-color: red;">'.'<label class="'.$class.'">'.'<a href="'.$helper->getCategoryUrl($category).'">'.$category->getName()."</a> (".$cat->getProductCount().")</label>" . '</li>';
}
if($category->hasChildren()) {
$children = Mage::getModel('catalog/category')->getCategories($category->getId());
$array .= '<li id="small-categ" style=" visibility: visible;">' . $this->get_categories($children) . '</li>';
}
$array .= '</li>';
}
return $array . '</ul>';
}
}
输出以下内容
我想输出
没有CSS业务(可见性/显示)
谢谢!
答案 0 :(得分:0)
我认为您应该编辑显示手风琴的.phtml文件以及类似
的文件echo($this->get_Categories($someArrayofAllTopLevelCategories));
将其更改为
$myParticularChildCategories = Mage::getModel('catalog/category')->getCategories([put here the integer ID of the Rochii category]);
echo($this->getCategories($myParticularChildCategories));