我想在左侧边栏而不是主列中显示类别说明.
我把它添加到我的catalog.xml:
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
<reference name="left">
<block type="catalog/navigation" name="catalog.catdes" after="catalog.leftnav" template="catalog/navigation/description.phtml"/>
</reference>
Run Code Online (Sandbox Code Playgroud)
我创建了这个文件:catalog/navigation/description.phtml
<?php
$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
?>
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description">
<?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
Run Code Online (Sandbox Code Playgroud)
根本没有结果.我能做错什么?
以下为我解决了这个问题.
echo Mage::getModel('catalog/layer')->getCurrentCategory()->getDescription();
Run Code Online (Sandbox Code Playgroud)
小智 4
您是否刚刚尝试回显 $_description ,因为您在 if 语句中将其设置为相等?
如果这不起作用,那么只需尝试加载它:
$cat = Mage::getModel('catalog/category')->load($_category->getId());
$description = $cat->getDescription();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12793 次 |
| 最近记录: |