【问题标题】:Categories not showing when calling block in magento在 magento 中调用块时未显示类别
【发布时间】:2014-03-13 07:46:44
【问题描述】:

我正在使用 Magento 中的页面 CMS 功能调用静态块。

它正在调用它,但每当我调用它时,类别都不会显示。

这是我在 CMS 的设计选项卡中添加的内容

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

另一方面,我的菜单代码是:

<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>

怎么了?我需要添加一个助手或我忘记的东西吗?

【问题讨论】:

    标签: php css magento


    【解决方案1】:

    请记住,这是使用非锚样式的类别查看,如果类别设置为锚,则此视图类型不适用。此外,一个简单但有时会遗漏的问题。您必须确保主页设置为使用 2columns-left 或 3 列布局。否则你引用一个你已经关闭的块。一切似乎都是正确的代码。

    【讨论】:

    • 我实际上需要将它转换为锚点,我实际上只是将其用作示例。如果我想实际使用锚点,我应该使用什么样的语法?
    • 块类型应该是 这个会参考分层导航块类型。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多