dqroktbn005028 2014-02-14 04:47
浏览 41

在magento中调用块时未显示的类别

I am calling a static block using the pages CMS functionality in Magento.

It's calling it, but the categories are not showing whenever I call it.

this is what I added in the design tab of the CMS

<reference name="left">
    <block type="catalog/navigation" name="catalog.leftnavig" before="-" template="catalog/navigation/left_menu1.phtml"/>
</reference>

On the other hand, The code for my menu is :

<div class="box layered-nav"> 
    <div class="head">
      <h3><?php echo $this->__('Browse By') ?></h3>
    </div>
    <div class="border-creator">
      <div class="narrow-by">
           <dl id="narrow-by-list">

         <dd>
           <ol>        
        <?php 
        $product = Mage::getModel('catalog/product')->load($productId);
        $cats = $product->getCategoryIds();

            foreach ($cats as $category_id) { 
                $_cat = Mage::getModel('catalog/category')->load($category_id) ;

            ?>
            <dt>
            <?php       echo $_cat->getName(); ?>
            </dt>
        <?php } ?>

       </ol>
      </dd>
      </dl><script type="text/javascript">decorateDataList('narrow-by-list')</script>
    </div>
   </div>
</div>

what is wrong? do I need to add a helper or something that I forgot?

  • 写回答

1条回答 默认 最新

  • douxin8610 2014-02-14 04:57
    关注

    Just remember this is using the non-anchor style of category viewing, if the categories are set as anchor, this view type is not applicable. Additionally, a simple but sometimes missed issue. You have to make sure that the home page is set to use 2columns-left or 3 column layout. Otherwise your referencing a block that you have turned off. Everything appears to be correct code wise.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line