我會建議不要問代碼更好,你試試這裏的人可以給點意見。
然後還... 轉到您的magento中的以下路徑(注意:在這裏我使用base/default/default,您必須在您的模板文件中使用)。
/應用程序/設計/前端/基/默認/模板/目錄/導航
創建新文件VERT-navigation.phtml
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<div class="vertical-nav">
<div class="navi-title"><h2>BROWSE BY CATEGORY</h2></div>
<?php echo $this->getChildHtml('topSearch') ?>
<ul>
<?php foreach($_categories as $_category): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>
</a>
<?php //if ($currentCategory->getName() == $_category->getName()): ?>
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
<?php $_subcategories = $_category->getChildrenCategories();
//$count=0; ?>
<?php if (count($_subcategories) > 0): ?>
<!--li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>
</a-->
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
</a>
</li>
<?php //$count++; ?>
<?php //if($count==4) break; ?>
<?php endforeach; ?>
</ul>
<?php //endif; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
然後去/應用程序/設計/前端/基地/default/layout/catalog.xml將下面的代碼
<reference name="content">
<!--block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/-->
<block type="catalog/navigation" before="-" name="catalog.vertnav" template="catalog/navigation/vert-navigation.phtml"/>
</reference>
你會看到範疇的全面上市做款式爲你的要求。