0
我們目前正在對內部的Magento我們的類別頁,並具有以下代碼爲類別,我們在提供兒童的類別列表Magento的 - 顯示父和子類別的下拉菜單
我們有。以下設置:
商店 - 貓1 - 光澤顏色(家長) - 子貓1 - Zurfiz(兒童) - 子貓2 - Parapan(兒童)
截圖下拉菜單中:http://awesomescreenshot.com/048kga35a
我們正在修改代碼以顯示「顯示全部」選項並鏈接到下拉菜單中的父類別以及子類別,有人知道我們應該爲此提供哪些代碼?
從應用程序\設計\前臺\ DEFAULT [我們的模板] \模板\目錄\導航\ left.phtml
<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories=$this->getCurrentChildCategories() ?>
<?php
$oLayer = null;
$oCat = $this->getCurrentCategory();
# level 3 categories display their category siblings
if (3 === (int)$oCat->getData('level')) {
# get the layer object
$oLayer = Mage::getSingleton('catalog/layer');
$oParentCategory = $oCat->getParentCategory();
# set the parent category as the current category
$oLayer->setData('current_category',$oParentCategory);
# load the child categories
$_categories = $this->getCurrentChildCategories();
}
?>
<?php if($_categories->count()): ?>
<div class="box layered-nav">
<?php
# switch back the current category
if (null !== $oLayer) $oLayer->setData('current_category',$oCat);
?>
<script language="javascript" type="text/javascript" >
function jumpto(x){
if (document.form1.jumpmenu.value != "null") {
document.location.href = x
}
}
</script>
<div class="cat-dropdown">
<form name="catlist">
<select name="jumpmenu" onChange="jumpto(document.catlist.jumpmenu.options[document.catlist.jumpmenu.options.selectedIndex].value)">
<option value="#">Choose a brand</option>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<option value="<?php echo $this->getCategoryUrl($_category) ?>"><?php echo $this->htmlEscape($_category->getName()) ?> (<?php echo $_category->getProductCount() ?>)</option>
<?php endif; ?>
<?php endforeach ?>
</select>
</form>
</div>
</div>
<?php endif; ?>
和你的問題是什麼? –
我們正在修改代碼以顯示「顯示全部」選項並鏈接到下拉菜單中的父類別以及子類別,有人知道我們應該爲此提供哪些代碼? –