1
我最近开始在magento工作,而我的老板给了我在左栏中显示类别的任务。我有一个静态HTML文件,我将其粘贴到.phtml文件中,并从xml块中调用它,并在左列中显示静态内容。在magento的左栏显示类别
我希望它们是动态的,以便可以从后端添加或删除类别。 我拥有的html格式是表格格式,我想将php代码插入到相同的html中,以便设计不受干扰,并且变得动态。
我最近开始在magento工作,而我的老板给了我在左栏中显示类别的任务。我有一个静态HTML文件,我将其粘贴到.phtml文件中,并从xml块中调用它,并在左列中显示静态内容。在magento的左栏显示类别
我希望它们是动态的,以便可以从后端添加或删除类别。 我拥有的html格式是表格格式,我想将php代码插入到相同的html中,以便设计不受干扰,并且变得动态。
这可能是你在找什么:
<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<div class="block block-layered-nav">
<div class="block-title">
<strong><span><?php echo $this->__('Browse By') ?></span></strong>
</div>
<div class="block-content">
<dl id="narrow-by-list2">
<dt><?php echo $this->__('Category') ?></dt>
<dd>
<ol>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
</li>
<?php endif; ?>
<?php endforeach ?>
</ol>
</dd>
</dl>
<script type="text/javascript">decorateDataList('narrow-by-list2')</script>
</div>
</div>
<?php endif; ?>